aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/setup-bus.c
diff options
context:
space:
mode:
authorYinghai Lu <yinghai@kernel.org>2012-01-21 05:08:29 -0500
committerJesse Barnes <jbarnes@virtuousgeek.org>2012-02-14 11:44:57 -0500
commitb9b0bba96cf5acbf025f7829fbf6c09e74323b41 (patch)
tree64dcc384b6aa90458608cda94bedf67e7486dad8 /drivers/pci/setup-bus.c
parent764242a0aec69e10b8dc0f4f0303a6800b09cf45 (diff)
PCI: Rename dev_res_x to add_res or fail_res
Linus says don't use dev_res_x because it doesn't communicate anything about usage. Rename them to add_res or fail_res etc according to context. Suggested-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Yinghai Lu <yinghai@kernel.org> Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Diffstat (limited to 'drivers/pci/setup-bus.c')
-rw-r--r--drivers/pci/setup-bus.c110
1 files changed, 55 insertions, 55 deletions
diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c
index af2a98a0ae7c..a6e427adc36d 100644
--- a/drivers/pci/setup-bus.c
+++ b/drivers/pci/setup-bus.c
@@ -95,32 +95,32 @@ static void add_to_failed_list(struct list_head *head,
95 0 /* dont care */); 95 0 /* dont care */);
96} 96}
97 97
98static void remove_from_list(struct list_head *realloc_head, 98static void remove_from_list(struct list_head *head,
99 struct resource *res) 99 struct resource *res)
100{ 100{
101 struct pci_dev_resource *dev_res_x, *tmp; 101 struct pci_dev_resource *dev_res, *tmp;
102 102
103 list_for_each_entry_safe(dev_res_x, tmp, realloc_head, list) { 103 list_for_each_entry_safe(dev_res, tmp, head, list) {
104 if (dev_res_x->res == res) { 104 if (dev_res->res == res) {
105 list_del(&dev_res_x->list); 105 list_del(&dev_res->list);
106 kfree(dev_res_x); 106 kfree(dev_res);
107 break; 107 break;
108 } 108 }
109 } 109 }
110} 110}
111 111
112static resource_size_t get_res_add_size(struct list_head *realloc_head, 112static resource_size_t get_res_add_size(struct list_head *head,
113 struct resource *res) 113 struct resource *res)
114{ 114{
115 struct pci_dev_resource *dev_res_x; 115 struct pci_dev_resource *dev_res;
116 116
117 list_for_each_entry(dev_res_x, realloc_head, list) { 117 list_for_each_entry(dev_res, head, list) {
118 if (dev_res_x->res == res) { 118 if (dev_res->res == res) {
119 dev_printk(KERN_DEBUG, &dev_res_x->dev->dev, 119 dev_printk(KERN_DEBUG, &dev_res->dev->dev,
120 "%pR get_res_add_size add_size %llx\n", 120 "%pR get_res_add_size add_size %llx\n",
121 dev_res_x->res, 121 dev_res->res,
122 (unsigned long long)dev_res_x->add_size); 122 (unsigned long long)dev_res->add_size);
123 return dev_res_x->add_size; 123 return dev_res->add_size;
124 } 124 }
125 } 125 }
126 126
@@ -221,15 +221,15 @@ static void reassign_resources_sorted(struct list_head *realloc_head,
221 struct list_head *head) 221 struct list_head *head)
222{ 222{
223 struct resource *res; 223 struct resource *res;
224 struct pci_dev_resource *dev_res_x, *tmp; 224 struct pci_dev_resource *add_res, *tmp;
225 struct pci_dev_resource *dev_res; 225 struct pci_dev_resource *dev_res;
226 resource_size_t add_size; 226 resource_size_t add_size;
227 int idx; 227 int idx;
228 228
229 list_for_each_entry_safe(dev_res_x, tmp, realloc_head, list) { 229 list_for_each_entry_safe(add_res, tmp, realloc_head, list) {
230 bool found_match = false; 230 bool found_match = false;
231 231
232 res = dev_res_x->res; 232 res = add_res->res;
233 /* skip resource that has been reset */ 233 /* skip resource that has been reset */
234 if (!res->flags) 234 if (!res->flags)
235 goto out; 235 goto out;
@@ -244,26 +244,26 @@ static void reassign_resources_sorted(struct list_head *realloc_head,
244 if (!found_match)/* just skip */ 244 if (!found_match)/* just skip */
245 continue; 245 continue;
246 246
247 idx = res - &dev_res_x->dev->resource[0]; 247 idx = res - &add_res->dev->resource[0];
248 add_size = dev_res_x->add_size; 248 add_size = add_res->add_size;
249 if (!resource_size(res)) { 249 if (!resource_size(res)) {
250 res->start = dev_res_x->start; 250 res->start = add_res->start;
251 res->end = res->start + add_size - 1; 251 res->end = res->start + add_size - 1;
252 if (pci_assign_resource(dev_res_x->dev, idx)) 252 if (pci_assign_resource(add_res->dev, idx))
253 reset_resource(res); 253 reset_resource(res);
254 } else { 254 } else {
255 resource_size_t align = dev_res_x->min_align; 255 resource_size_t align = add_res->min_align;
256 res->flags |= dev_res_x->flags & 256 res->flags |= add_res->flags &
257 (IORESOURCE_STARTALIGN|IORESOURCE_SIZEALIGN); 257 (IORESOURCE_STARTALIGN|IORESOURCE_SIZEALIGN);
258 if (pci_reassign_resource(dev_res_x->dev, idx, 258 if (pci_reassign_resource(add_res->dev, idx,
259 add_size, align)) 259 add_size, align))
260 dev_printk(KERN_DEBUG, &dev_res_x->dev->dev, 260 dev_printk(KERN_DEBUG, &add_res->dev->dev,
261 "failed to add optional resources res=%pR\n", 261 "failed to add optional resources res=%pR\n",
262 res); 262 res);
263 } 263 }
264out: 264out:
265 list_del(&dev_res_x->list); 265 list_del(&add_res->list);
266 kfree(dev_res_x); 266 kfree(add_res);
267 } 267 }
268} 268}
269 269
@@ -319,7 +319,7 @@ static void __assign_resources_sorted(struct list_head *head,
319 */ 319 */
320 LIST_HEAD(save_head); 320 LIST_HEAD(save_head);
321 LIST_HEAD(local_fail_head); 321 LIST_HEAD(local_fail_head);
322 struct pci_dev_resource *dev_res_x; 322 struct pci_dev_resource *save_res;
323 struct pci_dev_resource *dev_res; 323 struct pci_dev_resource *dev_res;
324 324
325 /* Check if optional add_size is there */ 325 /* Check if optional add_size is there */
@@ -358,12 +358,12 @@ static void __assign_resources_sorted(struct list_head *head,
358 if (dev_res->res->parent) 358 if (dev_res->res->parent)
359 release_resource(dev_res->res); 359 release_resource(dev_res->res);
360 /* Restore start/end/flags from saved list */ 360 /* Restore start/end/flags from saved list */
361 list_for_each_entry(dev_res_x, &save_head, list) { 361 list_for_each_entry(save_res, &save_head, list) {
362 struct resource *res = dev_res_x->res; 362 struct resource *res = save_res->res;
363 363
364 res->start = dev_res_x->start; 364 res->start = save_res->start;
365 res->end = dev_res_x->end; 365 res->end = save_res->end;
366 res->flags = dev_res_x->flags; 366 res->flags = save_res->flags;
367 } 367 }
368 free_list(pci_dev_resource, &save_head); 368 free_list(pci_dev_resource, &save_head);
369 369
@@ -1250,7 +1250,7 @@ pci_assign_unassigned_resources(void)
1250 int tried_times = 0; 1250 int tried_times = 0;
1251 enum release_type rel_type = leaf_only; 1251 enum release_type rel_type = leaf_only;
1252 LIST_HEAD(fail_head); 1252 LIST_HEAD(fail_head);
1253 struct pci_dev_resource *dev_res_x; 1253 struct pci_dev_resource *fail_res;
1254 unsigned long type_mask = IORESOURCE_IO | IORESOURCE_MEM | 1254 unsigned long type_mask = IORESOURCE_IO | IORESOURCE_MEM |
1255 IORESOURCE_PREFETCH; 1255 IORESOURCE_PREFETCH;
1256 unsigned long failed_type; 1256 unsigned long failed_type;
@@ -1289,8 +1289,8 @@ again:
1289 goto enable_and_dump; 1289 goto enable_and_dump;
1290 1290
1291 failed_type = 0; 1291 failed_type = 0;
1292 list_for_each_entry(dev_res_x, &fail_head, list) 1292 list_for_each_entry(fail_res, &fail_head, list)
1293 failed_type |= dev_res_x->flags; 1293 failed_type |= fail_res->flags;
1294 1294
1295 /* 1295 /*
1296 * io port are tight, don't try extra 1296 * io port are tight, don't try extra
@@ -1313,20 +1313,20 @@ again:
1313 * Try to release leaf bridge's resources that doesn't fit resource of 1313 * Try to release leaf bridge's resources that doesn't fit resource of
1314 * child device under that bridge 1314 * child device under that bridge
1315 */ 1315 */
1316 list_for_each_entry(dev_res_x, &fail_head, list) { 1316 list_for_each_entry(fail_res, &fail_head, list) {
1317 bus = dev_res_x->dev->bus; 1317 bus = fail_res->dev->bus;
1318 pci_bus_release_bridge_resources(bus, 1318 pci_bus_release_bridge_resources(bus,
1319 dev_res_x->flags & type_mask, 1319 fail_res->flags & type_mask,
1320 rel_type); 1320 rel_type);
1321 } 1321 }
1322 /* restore size and flags */ 1322 /* restore size and flags */
1323 list_for_each_entry(dev_res_x, &fail_head, list) { 1323 list_for_each_entry(fail_res, &fail_head, list) {
1324 struct resource *res = dev_res_x->res; 1324 struct resource *res = fail_res->res;
1325 1325
1326 res->start = dev_res_x->start; 1326 res->start = fail_res->start;
1327 res->end = dev_res_x->end; 1327 res->end = fail_res->end;
1328 res->flags = dev_res_x->flags; 1328 res->flags = fail_res->flags;
1329 if (dev_res_x->dev->subordinate) 1329 if (fail_res->dev->subordinate)
1330 res->flags = 0; 1330 res->flags = 0;
1331 } 1331 }
1332 free_list(pci_dev_resource, &fail_head); 1332 free_list(pci_dev_resource, &fail_head);
@@ -1350,7 +1350,7 @@ void pci_assign_unassigned_bridge_resources(struct pci_dev *bridge)
1350 want additional resources */ 1350 want additional resources */
1351 int tried_times = 0; 1351 int tried_times = 0;
1352 LIST_HEAD(fail_head); 1352 LIST_HEAD(fail_head);
1353 struct pci_dev_resource *dev_res_x; 1353 struct pci_dev_resource *fail_res;
1354 int retval; 1354 int retval;
1355 unsigned long type_mask = IORESOURCE_IO | IORESOURCE_MEM | 1355 unsigned long type_mask = IORESOURCE_IO | IORESOURCE_MEM |
1356 IORESOURCE_PREFETCH; 1356 IORESOURCE_PREFETCH;
@@ -1377,21 +1377,21 @@ again:
1377 * Try to release leaf bridge's resources that doesn't fit resource of 1377 * Try to release leaf bridge's resources that doesn't fit resource of
1378 * child device under that bridge 1378 * child device under that bridge
1379 */ 1379 */
1380 list_for_each_entry(dev_res_x, &fail_head, list) { 1380 list_for_each_entry(fail_res, &fail_head, list) {
1381 struct pci_bus *bus = dev_res_x->dev->bus; 1381 struct pci_bus *bus = fail_res->dev->bus;
1382 unsigned long flags = dev_res_x->flags; 1382 unsigned long flags = fail_res->flags;
1383 1383
1384 pci_bus_release_bridge_resources(bus, flags & type_mask, 1384 pci_bus_release_bridge_resources(bus, flags & type_mask,
1385 whole_subtree); 1385 whole_subtree);
1386 } 1386 }
1387 /* restore size and flags */ 1387 /* restore size and flags */
1388 list_for_each_entry(dev_res_x, &fail_head, list) { 1388 list_for_each_entry(fail_res, &fail_head, list) {
1389 struct resource *res = dev_res_x->res; 1389 struct resource *res = fail_res->res;
1390 1390
1391 res->start = dev_res_x->start; 1391 res->start = fail_res->start;
1392 res->end = dev_res_x->end; 1392 res->end = fail_res->end;
1393 res->flags = dev_res_x->flags; 1393 res->flags = fail_res->flags;
1394 if (dev_res_x->dev->subordinate) 1394 if (fail_res->dev->subordinate)
1395 res->flags = 0; 1395 res->flags = 0;
1396 } 1396 }
1397 free_list(pci_dev_resource, &fail_head); 1397 free_list(pci_dev_resource, &fail_head);