Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

can: ctucanfd: Remove redundant pci_clear_master

Remove pci_clear_master to simplify the code,
the bus-mastering is also cleared in do_pci_disable_device,
like this:
./drivers/pci/pci.c:2197
static void do_pci_disable_device(struct pci_dev *dev)
{
u16 pci_command;

pci_read_config_word(dev, PCI_COMMAND, &pci_command);
if (pci_command & PCI_COMMAND_MASTER) {
pci_command &= ~PCI_COMMAND_MASTER;
pci_write_config_word(dev, PCI_COMMAND, pci_command);
}

pcibios_disable_device(dev);
}.
And dev->is_busmaster is set to 0 in pci_disable_device.

Signed-off-by: Cai Huoqing <cai.huoqing@linux.dev>
Link: https://lore.kernel.org/all/20230323113318.9473-2-cai.huoqing@linux.dev
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>

authored by

Cai Huoqing and committed by
Marc Kleine-Budde
c9d23f96 59450334

+2 -6
+2 -6
drivers/net/can/ctucanfd/ctucanfd_pci.c
··· 206 206 err_pci_iounmap_bar1: 207 207 pci_iounmap(pdev, addr); 208 208 err_release_regions: 209 - if (msi_ok) { 209 + if (msi_ok) 210 210 pci_disable_msi(pdev); 211 - pci_clear_master(pdev); 212 - } 213 211 pci_release_regions(pdev); 214 212 err_disable_device: 215 213 pci_disable_device(pdev); ··· 255 257 256 258 pci_iounmap(pdev, bdata->bar1_base); 257 259 258 - if (bdata->use_msi) { 260 + if (bdata->use_msi) 259 261 pci_disable_msi(pdev); 260 - pci_clear_master(pdev); 261 - } 262 262 263 263 pci_release_regions(pdev); 264 264 pci_disable_device(pdev);