Message ID | 20220121140351.27382-4-pali@kernel.org |
---|---|
State | New |
Headers | show |
Series | Support for PCI_FILL_DRIVER | expand |
diff --git a/lib/sysfs.c b/lib/sysfs.c index 7714607f66a0..0dbd127ff53b 100644 --- a/lib/sysfs.c +++ b/lib/sysfs.c @@ -445,6 +445,19 @@ sysfs_fill_info(struct pci_dev *d, unsigned int flags) done |= PCI_FILL_DT_NODE; } + if (flags & PCI_FILL_DRIVER) + { + char *driver_path = sysfs_deref_link(d, "driver"); + if (driver_path) + { + char *driver = strrchr(driver_path, '/'); + driver = driver ? driver+1 : driver_path; + pci_set_property(d, PCI_FILL_DRIVER, driver); + free(driver_path); + } + done |= PCI_FILL_DRIVER; + } + return done | pci_generic_fill_info(d, flags & ~done); }