hc
2024-05-10 61598093bbdd283a7edc367d900f223070ead8d2
kernel/drivers/pci/search.c
....@@ -15,7 +15,6 @@
1515 #include "pci.h"
1616
1717 DECLARE_RWSEM(pci_bus_sem);
18
-EXPORT_SYMBOL_GPL(pci_bus_sem);
1918
2019 /*
2120 * pci_for_each_dma_alias - Iterate over DMA aliases for a device
....@@ -33,7 +32,13 @@
3332 struct pci_bus *bus;
3433 int ret;
3534
36
- ret = fn(pdev, PCI_DEVID(pdev->bus->number, pdev->devfn), data);
35
+ /*
36
+ * The device may have an explicit alias requester ID for DMA where the
37
+ * requester is on another PCI bus.
38
+ */
39
+ pdev = pci_real_dma_dev(pdev);
40
+
41
+ ret = fn(pdev, pci_dev_id(pdev), data);
3742 if (ret)
3843 return ret;
3944
....@@ -42,9 +47,9 @@
4247 * DMA, iterate over that too.
4348 */
4449 if (unlikely(pdev->dma_alias_mask)) {
45
- u8 devfn;
50
+ unsigned int devfn;
4651
47
- for_each_set_bit(devfn, pdev->dma_alias_mask, U8_MAX) {
52
+ for_each_set_bit(devfn, pdev->dma_alias_mask, MAX_NR_DEVFNS) {
4853 ret = fn(pdev, PCI_DEVID(pdev->bus->number, devfn),
4954 data);
5055 if (ret)
....@@ -88,9 +93,7 @@
8893 return ret;
8994 continue;
9095 case PCI_EXP_TYPE_PCIE_BRIDGE:
91
- ret = fn(tmp,
92
- PCI_DEVID(tmp->bus->number,
93
- tmp->devfn), data);
96
+ ret = fn(tmp, pci_dev_id(tmp), data);
9497 if (ret)
9598 return ret;
9699 continue;
....@@ -101,9 +104,7 @@
101104 PCI_DEVID(tmp->subordinate->number,
102105 PCI_DEVFN(0, 0)), data);
103106 else
104
- ret = fn(tmp,
105
- PCI_DEVID(tmp->bus->number,
106
- tmp->devfn), data);
107
+ ret = fn(tmp, pci_dev_id(tmp), data);
107108 if (ret)
108109 return ret;
109110 }
....@@ -111,7 +112,6 @@
111112
112113 return ret;
113114 }
114
-EXPORT_SYMBOL_GPL(pci_for_each_dma_alias);
115115
116116 static struct pci_bus *pci_do_find_bus(struct pci_bus *bus, unsigned char busnr)
117117 {
....@@ -241,10 +241,10 @@
241241 }
242242 EXPORT_SYMBOL(pci_get_domain_bus_and_slot);
243243
244
-static int match_pci_dev_by_id(struct device *dev, void *data)
244
+static int match_pci_dev_by_id(struct device *dev, const void *data)
245245 {
246246 struct pci_dev *pdev = to_pci_dev(dev);
247
- struct pci_device_id *id = data;
247
+ const struct pci_device_id *id = data;
248248
249249 if (pci_match_one_device(id, pdev))
250250 return 1;