diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-06-11 17:15:44 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-06-11 17:15:44 -0400 |
commit | eda054770e5cd0e9ee1568dfcbcf39f9ade4f545 (patch) | |
tree | 60d29e2a3b095e9d14657cc6e02daba0a1b5f63d | |
parent | 891a9894ee2e17646b29117635d2c7adfb58ce60 (diff) | |
parent | 837c4ef13c44296bb763a0ca0e84a076592474cf (diff) |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jbarnes/pci-2.6
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jbarnes/pci-2.6:
PCI: clear bridge resource range if BIOS assigned bad one
PCI: hotplug/cpqphp, fix NULL dereference
Revert "PCI: create function symlinks in /sys/bus/pci/slots/N/"
PCI: change resource collision messages from KERN_ERR to KERN_INFO
-rw-r--r-- | Documentation/ABI/testing/sysfs-bus-pci | 40 | ||||
-rw-r--r-- | arch/microblaze/pci/pci-common.c | 1 | ||||
-rw-r--r-- | arch/mn10300/unit-asb2305/pci-asb2305.c | 1 | ||||
-rw-r--r-- | arch/powerpc/kernel/pci-common.c | 1 | ||||
-rw-r--r-- | arch/x86/pci/i386.c | 2 | ||||
-rw-r--r-- | drivers/pci/hotplug/cpqphp_core.c | 7 | ||||
-rw-r--r-- | drivers/pci/pci-sysfs.c | 37 | ||||
-rw-r--r-- | drivers/pci/setup-res.c | 10 | ||||
-rw-r--r-- | drivers/pci/slot.c | 48 |
9 files changed, 17 insertions, 130 deletions
diff --git a/Documentation/ABI/testing/sysfs-bus-pci b/Documentation/ABI/testing/sysfs-bus-pci index 428676cfa61e..25be3250f7d6 100644 --- a/Documentation/ABI/testing/sysfs-bus-pci +++ b/Documentation/ABI/testing/sysfs-bus-pci | |||
@@ -133,46 +133,6 @@ Description: | |||
133 | The symbolic link points to the PCI device sysfs entry of the | 133 | The symbolic link points to the PCI device sysfs entry of the |
134 | Physical Function this device associates with. | 134 | Physical Function this device associates with. |
135 | 135 | ||
136 | |||
137 | What: /sys/bus/pci/slots/... | ||
138 | Date: April 2005 (possibly older) | ||
139 | KernelVersion: 2.6.12 (possibly older) | ||
140 | Contact: linux-pci@vger.kernel.org | ||
141 | Description: | ||
142 | When the appropriate driver is loaded, it will create a | ||
143 | directory per claimed physical PCI slot in | ||
144 | /sys/bus/pci/slots/. The names of these directories are | ||
145 | specific to the driver, which in turn, are specific to the | ||
146 | platform, but in general, should match the label on the | ||
147 | machine's physical chassis. | ||
148 | |||
149 | The drivers that can create slot directories include the | ||
150 | PCI hotplug drivers, and as of 2.6.27, the pci_slot driver. | ||
151 | |||
152 | The slot directories contain, at a minimum, a file named | ||
153 | 'address' which contains the PCI bus:device:function tuple. | ||
154 | Other files may appear as well, but are specific to the | ||
155 | driver. | ||
156 | |||
157 | What: /sys/bus/pci/slots/.../function[0-7] | ||
158 | Date: March 2010 | ||
159 | KernelVersion: 2.6.35 | ||
160 | Contact: linux-pci@vger.kernel.org | ||
161 | Description: | ||
162 | If PCI slot directories (as described above) are created, | ||
163 | and the physical slot is actually populated with a device, | ||
164 | symbolic links in the slot directory pointing to the | ||
165 | device's PCI functions are created as well. | ||
166 | |||
167 | What: /sys/bus/pci/devices/.../slot | ||
168 | Date: March 2010 | ||
169 | KernelVersion: 2.6.35 | ||
170 | Contact: linux-pci@vger.kernel.org | ||
171 | Description: | ||
172 | If PCI slot directories (as described above) are created, | ||
173 | a symbolic link pointing to the slot directory will be | ||
174 | created as well. | ||
175 | |||
176 | What: /sys/bus/pci/slots/.../module | 136 | What: /sys/bus/pci/slots/.../module |
177 | Date: June 2009 | 137 | Date: June 2009 |
178 | Contact: linux-pci@vger.kernel.org | 138 | Contact: linux-pci@vger.kernel.org |
diff --git a/arch/microblaze/pci/pci-common.c b/arch/microblaze/pci/pci-common.c index 9cb782b8e036..23be25fec4d6 100644 --- a/arch/microblaze/pci/pci-common.c +++ b/arch/microblaze/pci/pci-common.c | |||
@@ -1277,6 +1277,7 @@ void pcibios_allocate_bus_resources(struct pci_bus *bus) | |||
1277 | printk(KERN_WARNING "PCI: Cannot allocate resource region " | 1277 | printk(KERN_WARNING "PCI: Cannot allocate resource region " |
1278 | "%d of PCI bridge %d, will remap\n", i, bus->number); | 1278 | "%d of PCI bridge %d, will remap\n", i, bus->number); |
1279 | clear_resource: | 1279 | clear_resource: |
1280 | res->start = res->end = 0; | ||
1280 | res->flags = 0; | 1281 | res->flags = 0; |
1281 | } | 1282 | } |
1282 | 1283 | ||
diff --git a/arch/mn10300/unit-asb2305/pci-asb2305.c b/arch/mn10300/unit-asb2305/pci-asb2305.c index d6119b879a98..45b40ac6c464 100644 --- a/arch/mn10300/unit-asb2305/pci-asb2305.c +++ b/arch/mn10300/unit-asb2305/pci-asb2305.c | |||
@@ -117,6 +117,7 @@ static void __init pcibios_allocate_bus_resources(struct list_head *bus_list) | |||
117 | * Invalidate the resource to prevent | 117 | * Invalidate the resource to prevent |
118 | * child resource allocations in this | 118 | * child resource allocations in this |
119 | * range. */ | 119 | * range. */ |
120 | r->start = r->end = 0; | ||
120 | r->flags = 0; | 121 | r->flags = 0; |
121 | } | 122 | } |
122 | } | 123 | } |
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c index 6646005dffb1..5b38f6ae2b29 100644 --- a/arch/powerpc/kernel/pci-common.c +++ b/arch/powerpc/kernel/pci-common.c | |||
@@ -1309,6 +1309,7 @@ void pcibios_allocate_bus_resources(struct pci_bus *bus) | |||
1309 | printk(KERN_WARNING "PCI: Cannot allocate resource region " | 1309 | printk(KERN_WARNING "PCI: Cannot allocate resource region " |
1310 | "%d of PCI bridge %d, will remap\n", i, bus->number); | 1310 | "%d of PCI bridge %d, will remap\n", i, bus->number); |
1311 | clear_resource: | 1311 | clear_resource: |
1312 | res->start = res->end = 0; | ||
1312 | res->flags = 0; | 1313 | res->flags = 0; |
1313 | } | 1314 | } |
1314 | 1315 | ||
diff --git a/arch/x86/pci/i386.c b/arch/x86/pci/i386.c index 97da2ba9344b..6fdb3ec30c31 100644 --- a/arch/x86/pci/i386.c +++ b/arch/x86/pci/i386.c | |||
@@ -96,6 +96,7 @@ EXPORT_SYMBOL(pcibios_align_resource); | |||
96 | * the fact the PCI specs explicitly allow address decoders to be | 96 | * the fact the PCI specs explicitly allow address decoders to be |
97 | * shared between expansion ROMs and other resource regions, it's | 97 | * shared between expansion ROMs and other resource regions, it's |
98 | * at least dangerous) | 98 | * at least dangerous) |
99 | * - bad resource sizes or overlaps with other regions | ||
99 | * | 100 | * |
100 | * Our solution: | 101 | * Our solution: |
101 | * (1) Allocate resources for all buses behind PCI-to-PCI bridges. | 102 | * (1) Allocate resources for all buses behind PCI-to-PCI bridges. |
@@ -136,6 +137,7 @@ static void __init pcibios_allocate_bus_resources(struct list_head *bus_list) | |||
136 | * child resource allocations in this | 137 | * child resource allocations in this |
137 | * range. | 138 | * range. |
138 | */ | 139 | */ |
140 | r->start = r->end = 0; | ||
139 | r->flags = 0; | 141 | r->flags = 0; |
140 | } | 142 | } |
141 | } | 143 | } |
diff --git a/drivers/pci/hotplug/cpqphp_core.c b/drivers/pci/hotplug/cpqphp_core.c index b3e5580c837b..4952c3b9379d 100644 --- a/drivers/pci/hotplug/cpqphp_core.c +++ b/drivers/pci/hotplug/cpqphp_core.c | |||
@@ -828,7 +828,14 @@ static int cpqhpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
828 | pci_name(pdev), err); | 828 | pci_name(pdev), err); |
829 | return err; | 829 | return err; |
830 | } | 830 | } |
831 | |||
831 | bus = pdev->subordinate; | 832 | bus = pdev->subordinate; |
833 | if (!bus) { | ||
834 | dev_notice(&pdev->dev, "the device is not a bridge, " | ||
835 | "skipping\n"); | ||
836 | rc = -ENODEV; | ||
837 | goto err_disable_device; | ||
838 | } | ||
832 | 839 | ||
833 | /* Need to read VID early b/c it's used to differentiate CPQ and INTC | 840 | /* Need to read VID early b/c it's used to differentiate CPQ and INTC |
834 | * discovery | 841 | * discovery |
diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c index afd2fbf7d797..c9957f68ac9b 100644 --- a/drivers/pci/pci-sysfs.c +++ b/drivers/pci/pci-sysfs.c | |||
@@ -1035,39 +1035,6 @@ error: | |||
1035 | return retval; | 1035 | return retval; |
1036 | } | 1036 | } |
1037 | 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 | |||
1071 | int __must_check pci_create_sysfs_dev_files (struct pci_dev *pdev) | 1038 | int __must_check pci_create_sysfs_dev_files (struct pci_dev *pdev) |
1072 | { | 1039 | { |
1073 | int retval; | 1040 | int retval; |
@@ -1130,8 +1097,6 @@ int __must_check pci_create_sysfs_dev_files (struct pci_dev *pdev) | |||
1130 | if (retval) | 1097 | if (retval) |
1131 | goto err_vga_file; | 1098 | goto err_vga_file; |
1132 | 1099 | ||
1133 | pci_create_slot_links(pdev); | ||
1134 | |||
1135 | return 0; | 1100 | return 0; |
1136 | 1101 | ||
1137 | err_vga_file: | 1102 | err_vga_file: |
@@ -1181,8 +1146,6 @@ void pci_remove_sysfs_dev_files(struct pci_dev *pdev) | |||
1181 | if (!sysfs_initialized) | 1146 | if (!sysfs_initialized) |
1182 | return; | 1147 | return; |
1183 | 1148 | ||
1184 | pci_remove_slot_links(pdev); | ||
1185 | |||
1186 | pci_remove_capabilities_sysfs(pdev); | 1149 | pci_remove_capabilities_sysfs(pdev); |
1187 | 1150 | ||
1188 | if (pdev->cfg_size < PCI_CFG_SPACE_EXP_SIZE) | 1151 | if (pdev->cfg_size < PCI_CFG_SPACE_EXP_SIZE) |
diff --git a/drivers/pci/setup-res.c b/drivers/pci/setup-res.c index 17bed18d24ad..92379e2d37e7 100644 --- a/drivers/pci/setup-res.c +++ b/drivers/pci/setup-res.c | |||
@@ -97,16 +97,16 @@ int pci_claim_resource(struct pci_dev *dev, int resource) | |||
97 | 97 | ||
98 | root = pci_find_parent_resource(dev, res); | 98 | root = pci_find_parent_resource(dev, res); |
99 | if (!root) { | 99 | if (!root) { |
100 | dev_err(&dev->dev, "no compatible bridge window for %pR\n", | 100 | dev_info(&dev->dev, "no compatible bridge window for %pR\n", |
101 | res); | 101 | res); |
102 | return -EINVAL; | 102 | return -EINVAL; |
103 | } | 103 | } |
104 | 104 | ||
105 | conflict = request_resource_conflict(root, res); | 105 | conflict = request_resource_conflict(root, res); |
106 | if (conflict) { | 106 | if (conflict) { |
107 | dev_err(&dev->dev, | 107 | dev_info(&dev->dev, |
108 | "address space collision: %pR conflicts with %s %pR\n", | 108 | "address space collision: %pR conflicts with %s %pR\n", |
109 | res, conflict->name, conflict); | 109 | res, conflict->name, conflict); |
110 | return -EBUSY; | 110 | return -EBUSY; |
111 | } | 111 | } |
112 | 112 | ||
diff --git a/drivers/pci/slot.c b/drivers/pci/slot.c index e0189cf7c558..659eaa0fc48f 100644 --- a/drivers/pci/slot.c +++ b/drivers/pci/slot.c | |||
@@ -97,50 +97,6 @@ static ssize_t cur_speed_read_file(struct pci_slot *slot, char *buf) | |||
97 | return bus_speed_read(slot->bus->cur_bus_speed, buf); | 97 | return bus_speed_read(slot->bus->cur_bus_speed, buf); |
98 | } | 98 | } |
99 | 99 | ||
100 | static void remove_sysfs_files(struct pci_slot *slot) | ||
101 | { | ||
102 | char func[10]; | ||
103 | struct list_head *tmp; | ||
104 | |||
105 | list_for_each(tmp, &slot->bus->devices) { | ||
106 | struct pci_dev *dev = pci_dev_b(tmp); | ||
107 | if (PCI_SLOT(dev->devfn) != slot->number) | ||
108 | continue; | ||
109 | sysfs_remove_link(&dev->dev.kobj, "slot"); | ||
110 | |||
111 | snprintf(func, 10, "function%d", PCI_FUNC(dev->devfn)); | ||
112 | sysfs_remove_link(&slot->kobj, func); | ||
113 | } | ||
114 | } | ||
115 | |||
116 | static int create_sysfs_files(struct pci_slot *slot) | ||
117 | { | ||
118 | int result; | ||
119 | char func[10]; | ||
120 | struct list_head *tmp; | ||
121 | |||
122 | list_for_each(tmp, &slot->bus->devices) { | ||
123 | struct pci_dev *dev = pci_dev_b(tmp); | ||
124 | if (PCI_SLOT(dev->devfn) != slot->number) | ||
125 | continue; | ||
126 | |||
127 | result = sysfs_create_link(&dev->dev.kobj, &slot->kobj, "slot"); | ||
128 | if (result) | ||
129 | goto fail; | ||
130 | |||
131 | snprintf(func, 10, "function%d", PCI_FUNC(dev->devfn)); | ||
132 | result = sysfs_create_link(&slot->kobj, &dev->dev.kobj, func); | ||
133 | if (result) | ||
134 | goto fail; | ||
135 | } | ||
136 | |||
137 | return 0; | ||
138 | |||
139 | fail: | ||
140 | remove_sysfs_files(slot); | ||
141 | return result; | ||
142 | } | ||
143 | |||
144 | static void pci_slot_release(struct kobject *kobj) | 100 | static void pci_slot_release(struct kobject *kobj) |
145 | { | 101 | { |
146 | struct pci_dev *dev; | 102 | struct pci_dev *dev; |
@@ -153,8 +109,6 @@ static void pci_slot_release(struct kobject *kobj) | |||
153 | if (PCI_SLOT(dev->devfn) == slot->number) | 109 | if (PCI_SLOT(dev->devfn) == slot->number) |
154 | dev->slot = NULL; | 110 | dev->slot = NULL; |
155 | 111 | ||
156 | remove_sysfs_files(slot); | ||
157 | |||
158 | list_del(&slot->list); | 112 | list_del(&slot->list); |
159 | 113 | ||
160 | kfree(slot); | 114 | kfree(slot); |
@@ -346,8 +300,6 @@ placeholder: | |||
346 | INIT_LIST_HEAD(&slot->list); | 300 | INIT_LIST_HEAD(&slot->list); |
347 | list_add(&slot->list, &parent->slots); | 301 | list_add(&slot->list, &parent->slots); |
348 | 302 | ||
349 | create_sysfs_files(slot); | ||
350 | |||
351 | list_for_each_entry(dev, &parent->devices, bus_list) | 303 | list_for_each_entry(dev, &parent->devices, bus_list) |
352 | if (PCI_SLOT(dev->devfn) == slot_nr) | 304 | if (PCI_SLOT(dev->devfn) == slot_nr) |
353 | dev->slot = slot; | 305 | dev->slot = slot; |