summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg KH <gregkh@suse.de>2005-05-05 20:57:25 +0200
committerGreg KH <gregkh@suse.de>2005-05-17 23:31:12 +0200
commit9888549e0507cc95d1d7ade1595c00ff8e902659 (patch)
tree9c31d2b34ef9b747733f7f39916a8031f89c3d1e
parent[PATCH] PCI Hotplug: remove pci_visit_dev (diff)
downloadlinux-9888549e0507cc95d1d7ade1595c00ff8e902659.tar.xz
linux-9888549e0507cc95d1d7ade1595c00ff8e902659.zip
[PATCH] PCI: add modalias sysfs file for pci devices
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--drivers/pci/pci-sysfs.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c
index 8568b207f189..6ca0061137a6 100644
--- a/drivers/pci/pci-sysfs.c
+++ b/drivers/pci/pci-sysfs.c
@@ -73,6 +73,17 @@ resource_show(struct device * dev, char * buf)
return (str - buf);
}
+static ssize_t modalias_show(struct device *dev, char *buf)
+{
+ struct pci_dev *pci_dev = to_pci_dev(dev);
+
+ return sprintf(buf, "pci:v%08Xd%08Xsv%08Xsd%08Xbc%02Xsc%02Xi%02x\n",
+ pci_dev->vendor, pci_dev->device,
+ pci_dev->subsystem_vendor, pci_dev->subsystem_device,
+ (u8)(pci_dev->class >> 16), (u8)(pci_dev->class >> 8),
+ (u8)(pci_dev->class));
+}
+
struct device_attribute pci_dev_attrs[] = {
__ATTR_RO(resource),
__ATTR_RO(vendor),
@@ -82,6 +93,7 @@ struct device_attribute pci_dev_attrs[] = {
__ATTR_RO(class),
__ATTR_RO(irq),
__ATTR_RO(local_cpus),
+ __ATTR_RO(modalias),
__ATTR_NULL,
};