diff options
-rw-r--r-- | drivers/pci/pci-sysfs.c | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c index 1c8929801400..ec7a175dcbaf 100644 --- a/drivers/pci/pci-sysfs.c +++ b/drivers/pci/pci-sysfs.c | |||
@@ -241,6 +241,17 @@ struct device_attribute pci_dev_attrs[] = { | |||
241 | }; | 241 | }; |
242 | 242 | ||
243 | static ssize_t | 243 | static ssize_t |
244 | boot_vga_show(struct device *dev, struct device_attribute *attr, char *buf) | ||
245 | { | ||
246 | struct pci_dev *pdev = to_pci_dev(dev); | ||
247 | |||
248 | return sprintf(buf, "%u\n", | ||
249 | !!(pdev->resource[PCI_ROM_RESOURCE].flags & | ||
250 | IORESOURCE_ROM_SHADOW)); | ||
251 | } | ||
252 | struct device_attribute vga_attr = __ATTR_RO(boot_vga); | ||
253 | |||
254 | static ssize_t | ||
244 | pci_read_config(struct kobject *kobj, struct bin_attribute *bin_attr, | 255 | pci_read_config(struct kobject *kobj, struct bin_attribute *bin_attr, |
245 | char *buf, loff_t off, size_t count) | 256 | char *buf, loff_t off, size_t count) |
246 | { | 257 | { |
@@ -899,18 +910,27 @@ int __must_check pci_create_sysfs_dev_files (struct pci_dev *pdev) | |||
899 | pdev->rom_attr = attr; | 910 | pdev->rom_attr = attr; |
900 | } | 911 | } |
901 | 912 | ||
913 | if ((pdev->class >> 8) == PCI_CLASS_DISPLAY_VGA) { | ||
914 | retval = device_create_file(&pdev->dev, &vga_attr); | ||
915 | if (retval) | ||
916 | goto err_rom_file; | ||
917 | } | ||
918 | |||
902 | /* add platform-specific attributes */ | 919 | /* add platform-specific attributes */ |
903 | retval = pcibios_add_platform_entries(pdev); | 920 | retval = pcibios_add_platform_entries(pdev); |
904 | if (retval) | 921 | if (retval) |
905 | goto err_rom_file; | 922 | goto err_vga_file; |
906 | 923 | ||
907 | /* add sysfs entries for various capabilities */ | 924 | /* add sysfs entries for various capabilities */ |
908 | retval = pci_create_capabilities_sysfs(pdev); | 925 | retval = pci_create_capabilities_sysfs(pdev); |
909 | if (retval) | 926 | if (retval) |
910 | goto err_rom_file; | 927 | goto err_vga_file; |
911 | 928 | ||
912 | return 0; | 929 | return 0; |
913 | 930 | ||
931 | err_vga_file: | ||
932 | if ((pdev->class >> 8) == PCI_CLASS_DISPLAY_VGA) | ||
933 | device_remove_file(&pdev->dev, &vga_attr); | ||
914 | err_rom_file: | 934 | err_rom_file: |
915 | if (rom_size) { | 935 | if (rom_size) { |
916 | sysfs_remove_bin_file(&pdev->dev.kobj, pdev->rom_attr); | 936 | sysfs_remove_bin_file(&pdev->dev.kobj, pdev->rom_attr); |