aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci
diff options
context:
space:
mode:
authorGreg KH <gregkh@suse.de>2005-05-05 14:57:25 -0400
committerGreg KH <gregkh@suse.de>2005-05-17 17:31:12 -0400
commit9888549e0507cc95d1d7ade1595c00ff8e902659 (patch)
tree9c31d2b34ef9b747733f7f39916a8031f89c3d1e /drivers/pci
parentc22610dadc0452b1273494f2b5157123c6cd60e1 (diff)
[PATCH] PCI: add modalias sysfs file for pci devices
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/pci')
-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)
73 return (str - buf); 73 return (str - buf);
74} 74}
75 75
76static ssize_t modalias_show(struct device *dev, char *buf)
77{
78 struct pci_dev *pci_dev = to_pci_dev(dev);
79
80 return sprintf(buf, "pci:v%08Xd%08Xsv%08Xsd%08Xbc%02Xsc%02Xi%02x\n",
81 pci_dev->vendor, pci_dev->device,
82 pci_dev->subsystem_vendor, pci_dev->subsystem_device,
83 (u8)(pci_dev->class >> 16), (u8)(pci_dev->class >> 8),
84 (u8)(pci_dev->class));
85}
86
76struct device_attribute pci_dev_attrs[] = { 87struct device_attribute pci_dev_attrs[] = {
77 __ATTR_RO(resource), 88 __ATTR_RO(resource),
78 __ATTR_RO(vendor), 89 __ATTR_RO(vendor),
@@ -82,6 +93,7 @@ struct device_attribute pci_dev_attrs[] = {
82 __ATTR_RO(class), 93 __ATTR_RO(class),
83 __ATTR_RO(irq), 94 __ATTR_RO(irq),
84 __ATTR_RO(local_cpus), 95 __ATTR_RO(local_cpus),
96 __ATTR_RO(modalias),
85 __ATTR_NULL, 97 __ATTR_NULL,
86}; 98};
87 99