Commit 9888549e0507cc95d1d7ade1595c00ff8e902659
1 parent
c22610dadc
Exists in
master
and in
7 other branches
[PATCH] PCI: add modalias sysfs file for pci devices
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Showing 1 changed file with 12 additions and 0 deletions Side-by-side Diff
drivers/pci/pci-sysfs.c
... | ... | @@ -73,6 +73,17 @@ |
73 | 73 | return (str - buf); |
74 | 74 | } |
75 | 75 | |
76 | +static 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 | + | |
76 | 87 | struct device_attribute pci_dev_attrs[] = { |
77 | 88 | __ATTR_RO(resource), |
78 | 89 | __ATTR_RO(vendor), |
... | ... | @@ -82,6 +93,7 @@ |
82 | 93 | __ATTR_RO(class), |
83 | 94 | __ATTR_RO(irq), |
84 | 95 | __ATTR_RO(local_cpus), |
96 | + __ATTR_RO(modalias), | |
85 | 97 | __ATTR_NULL, |
86 | 98 | }; |
87 | 99 |