[PATCH pciutils 3/4] libpci: sysfs: Implement support for PCI_FILL_DRIVER

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In sysfs is driver name stored as symlink path of "driver" node.
---
 lib/sysfs.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

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);
 }
 
-- 
2.20.1




[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux