PCI: export pci_match_device()
PATCH 1/2 PCI: export pci_match_device()
pci_match_id() is deprecated as it doesn't catch any dynamic ids that a driver might want to check for.
Export pci_match_device() as a replacement which supports both dynamic and static ids.
--- drivers/pci/pci-driver.c | 3 ++- include/linux/pci.h | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-)
drivers/pci/pci-driver.c +2 -1
@@ -250,7 +250,7 @@ const struct pci_device_id *pci_match_id(const struct pci_device_id *ids,* system is in its list of supported devices. Returns the matching * pci_device_id structure or %NULL if there is no match. */ -static const struct pci_device_id *pci_match_device (struct pci_driver *drv, +const struct pci_device_id *pci_match_device (struct pci_driver *drv,struct pci_dev *dev) {struct pci_dynid *dynid;
@@ -279,6 +279,7 @@ static const struct pci_device_id *pci_match_device(struct pci_driver *drv,return found_id; } +EXPORT_SYMBOL (pci_match_device);struct drv_dev_and_id {struct pci_driver *drv;
include/linux/pci.h +2 -0
@@ -1406,6 +1406,8 @@ int pci_add_dynid(struct pci_driver *drv, unsigned long driver_data);const struct pci_device_id *pci_match_id (const struct pci_device_id *ids,struct pci_dev *dev); +const struct pci_device_id *pci_match_device (struct pci_driver *drv, +struct pci_dev *dev);int pci_scan_bridge (struct pci_bus *bus,struct pci_dev *dev,int max,int pass);
Signature · 1 line
1.8.3.1
PATCH 2/2 PCI: add support for dynamic ID when checking for duplicate IDs
When a device ID data is writen to /sys/bus/pci/drivers/.../new_id, only static ID table is checked for duplicate and multiple dynamic id entries of same kind are allowed to be dynamically linked.
Fix it by calling pci_match_device() which checks both dynamic and static IDs.
--- drivers/pci/pci-driver.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/pci-driver.c +1 -1
@@ -125,7 +125,7 @@ static ssize_t new_id_store(struct device_driver *driver, const char *buf, pdev->subsystem_device = subdevice; pdev->class = class; -if (pci_match_id (pdrv->id_table, pdev)) +if (pci_match_device (pdrv, pdev)) retval = -EEXIST ;kfree (pdev);
Signature · 1 line
1.8.3.1
Quoted 5 lines · Zhenzhong Duan
pci_match_id()is deprecated as it doesn't catch any dynamic ids that a driver might want to check for.Export
pci_match_device()as a replacement which supports both dynamic and static ids.
You don't actually seems to add any user outside of the PCI core, so I think you only need to drop the static specifier and add a prototype.
Quoted 11 lines · Christoph Hellwig
Quoted 5 lines · Zhenzhong Duan
pci_match_id()is deprecated as it doesn't catch any dynamic ids that a driver might want to check for.Export
pci_match_device()as a replacement which supports both dynamic and static ids.You don't actually seems to add any user outside of the PCI core, so I think you only need to drop the static specifier and add a prototype.
Thanks for review, will do it. I'll combine the two patches into one if no need to export.