[PATCH] PCI: add modalias sysfs file for pci devices

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

Greg KH 9888549e c22610da

+12
+12
drivers/pci/pci-sysfs.c
··· 73 return (str - buf); 74 } 75 76 struct device_attribute pci_dev_attrs[] = { 77 __ATTR_RO(resource), 78 __ATTR_RO(vendor), ··· 93 __ATTR_RO(class), 94 __ATTR_RO(irq), 95 __ATTR_RO(local_cpus), 96 __ATTR_NULL, 97 }; 98
··· 73 return (str - buf); 74 } 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 + 87 struct device_attribute pci_dev_attrs[] = { 88 __ATTR_RO(resource), 89 __ATTR_RO(vendor), ··· 82 __ATTR_RO(class), 83 __ATTR_RO(irq), 84 __ATTR_RO(local_cpus), 85 + __ATTR_RO(modalias), 86 __ATTR_NULL, 87 }; 88