diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-05-21 21:58:52 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-05-21 21:58:52 -0400 |
commit | 6109e2ce2600e2db26cd0424bb9c6ed019723288 (patch) | |
tree | 54b5d347bf12e0a987edfb52f287399f748a9a38 /drivers/pci/pci-sysfs.c | |
parent | 0961d6581c870850342ad6ea25263763433d666f (diff) | |
parent | ac81860ea073daed50246af54db706c6e491f240 (diff) |
Merge branch 'linux-next' of git://git.kernel.org/pub/scm/linux/kernel/git/jbarnes/pci-2.6
* 'linux-next' of git://git.kernel.org/pub/scm/linux/kernel/git/jbarnes/pci-2.6: (36 commits)
PCI: hotplug: pciehp: Removed check for hotplug of display devices
PCI: read memory ranges out of Broadcom CNB20LE host bridge
PCI: Allow manual resource allocation for PCI hotplug bridges
x86/PCI: make ACPI MCFG reserved error messages ACPI specific
PCI hotplug: Use kmemdup
PM/PCI: Update PCI power management documentation
PCI: output FW warning in pci_read/write_vpd
PCI: fix typos pci_device_dis/enable to pci_dis/enable_device in comments
PCI quirks: disable msi on AMD rs4xx internal gfx bridges
PCI: Disable MSI for MCP55 on P5N32-E SLI
x86/PCI: irq and pci_ids patch for additional Intel Cougar Point DeviceIDs
PCI: aerdrv: trivial cleanup for aerdrv_core.c
PCI: aerdrv: trivial cleanup for aerdrv.c
PCI: aerdrv: introduce default_downstream_reset_link
PCI: aerdrv: rework find_aer_service
PCI: aerdrv: remove is_downstream
PCI: aerdrv: remove magical ROOT_ERR_STATUS_MASKS
PCI: aerdrv: redefine PCI_ERR_ROOT_*_SRC
PCI: aerdrv: rework do_recovery
PCI: aerdrv: rework get_e_source()
...
Diffstat (limited to 'drivers/pci/pci-sysfs.c')
-rw-r--r-- | drivers/pci/pci-sysfs.c | 44 |
1 files changed, 43 insertions, 1 deletions
diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c index 6309c5a2528f..afd2fbf7d797 100644 --- a/drivers/pci/pci-sysfs.c +++ b/drivers/pci/pci-sysfs.c | |||
@@ -979,7 +979,12 @@ static ssize_t reset_store(struct device *dev, | |||
979 | 979 | ||
980 | if (val != 1) | 980 | if (val != 1) |
981 | return -EINVAL; | 981 | return -EINVAL; |
982 | return pci_reset_function(pdev); | 982 | |
983 | result = pci_reset_function(pdev); | ||
984 | if (result < 0) | ||
985 | return result; | ||
986 | |||
987 | return count; | ||
983 | } | 988 | } |
984 | 989 | ||
985 | static struct device_attribute reset_attr = __ATTR(reset, 0200, NULL, reset_store); | 990 | static struct device_attribute reset_attr = __ATTR(reset, 0200, NULL, reset_store); |
@@ -1030,6 +1035,39 @@ error: | |||
1030 | return retval; | 1035 | return retval; |
1031 | } | 1036 | } |
1032 | 1037 | ||
1038 | static void pci_remove_slot_links(struct pci_dev *dev) | ||
1039 | { | ||
1040 | char func[10]; | ||
1041 | struct pci_slot *slot; | ||
1042 | |||
1043 | sysfs_remove_link(&dev->dev.kobj, "slot"); | ||
1044 | list_for_each_entry(slot, &dev->bus->slots, list) { | ||
1045 | if (slot->number != PCI_SLOT(dev->devfn)) | ||
1046 | continue; | ||
1047 | snprintf(func, 10, "function%d", PCI_FUNC(dev->devfn)); | ||
1048 | sysfs_remove_link(&slot->kobj, func); | ||
1049 | } | ||
1050 | } | ||
1051 | |||
1052 | static int pci_create_slot_links(struct pci_dev *dev) | ||
1053 | { | ||
1054 | int result = 0; | ||
1055 | char func[10]; | ||
1056 | struct pci_slot *slot; | ||
1057 | |||
1058 | list_for_each_entry(slot, &dev->bus->slots, list) { | ||
1059 | if (slot->number != PCI_SLOT(dev->devfn)) | ||
1060 | continue; | ||
1061 | result = sysfs_create_link(&dev->dev.kobj, &slot->kobj, "slot"); | ||
1062 | if (result) | ||
1063 | goto out; | ||
1064 | snprintf(func, 10, "function%d", PCI_FUNC(dev->devfn)); | ||
1065 | result = sysfs_create_link(&slot->kobj, &dev->dev.kobj, func); | ||
1066 | } | ||
1067 | out: | ||
1068 | return result; | ||
1069 | } | ||
1070 | |||
1033 | int __must_check pci_create_sysfs_dev_files (struct pci_dev *pdev) | 1071 | int __must_check pci_create_sysfs_dev_files (struct pci_dev *pdev) |
1034 | { | 1072 | { |
1035 | int retval; | 1073 | int retval; |
@@ -1092,6 +1130,8 @@ int __must_check pci_create_sysfs_dev_files (struct pci_dev *pdev) | |||
1092 | if (retval) | 1130 | if (retval) |
1093 | goto err_vga_file; | 1131 | goto err_vga_file; |
1094 | 1132 | ||
1133 | pci_create_slot_links(pdev); | ||
1134 | |||
1095 | return 0; | 1135 | return 0; |
1096 | 1136 | ||
1097 | err_vga_file: | 1137 | err_vga_file: |
@@ -1141,6 +1181,8 @@ void pci_remove_sysfs_dev_files(struct pci_dev *pdev) | |||
1141 | if (!sysfs_initialized) | 1181 | if (!sysfs_initialized) |
1142 | return; | 1182 | return; |
1143 | 1183 | ||
1184 | pci_remove_slot_links(pdev); | ||
1185 | |||
1144 | pci_remove_capabilities_sysfs(pdev); | 1186 | pci_remove_capabilities_sysfs(pdev); |
1145 | 1187 | ||
1146 | if (pdev->cfg_size < PCI_CFG_SPACE_EXP_SIZE) | 1188 | if (pdev->cfg_size < PCI_CFG_SPACE_EXP_SIZE) |