diff options
author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-04-19 22:17:30 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-04-19 22:17:30 -0400 |
commit | 7cd9c9bb57476167e83b7780dbc06d1dd601789d (patch) | |
tree | afcf43a6d5e4661306676ebcd08224906170b578 /drivers/base/bus.c | |
parent | 591bfc6bf9e5e25e464fd4c87d64afd5135667c4 (diff) |
Revert "driver core: check start node in klist_iter_init_node"
This reverts commit a15d49fd3094cff90e5410ca454a870e0a722fe1 as that
patch broke the build.
Cc: Hannes Reinecke <hare@suse.de>
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/base/bus.c')
-rw-r--r-- | drivers/base/bus.c | 46 |
1 files changed, 17 insertions, 29 deletions
diff --git a/drivers/base/bus.c b/drivers/base/bus.c index 76aed01a8b2c..2bcef657a60c 100644 --- a/drivers/base/bus.c +++ b/drivers/base/bus.c | |||
@@ -296,13 +296,11 @@ int bus_for_each_dev(struct bus_type *bus, struct device *start, | |||
296 | if (!bus) | 296 | if (!bus) |
297 | return -EINVAL; | 297 | return -EINVAL; |
298 | 298 | ||
299 | error = klist_iter_init_node(&bus->p->klist_devices, &i, | 299 | klist_iter_init_node(&bus->p->klist_devices, &i, |
300 | (start ? &start->p->knode_bus : NULL)); | 300 | (start ? &start->p->knode_bus : NULL)); |
301 | if (!error) { | 301 | while ((dev = next_device(&i)) && !error) |
302 | while ((dev = next_device(&i)) && !error) | 302 | error = fn(dev, data); |
303 | error = fn(dev, data); | 303 | klist_iter_exit(&i); |
304 | klist_iter_exit(&i); | ||
305 | } | ||
306 | return error; | 304 | return error; |
307 | } | 305 | } |
308 | EXPORT_SYMBOL_GPL(bus_for_each_dev); | 306 | EXPORT_SYMBOL_GPL(bus_for_each_dev); |
@@ -332,10 +330,8 @@ struct device *bus_find_device(struct bus_type *bus, | |||
332 | if (!bus) | 330 | if (!bus) |
333 | return NULL; | 331 | return NULL; |
334 | 332 | ||
335 | if (klist_iter_init_node(&bus->p->klist_devices, &i, | 333 | klist_iter_init_node(&bus->p->klist_devices, &i, |
336 | (start ? &start->p->knode_bus : NULL)) < 0) | 334 | (start ? &start->p->knode_bus : NULL)); |
337 | return NULL; | ||
338 | |||
339 | while ((dev = next_device(&i))) | 335 | while ((dev = next_device(&i))) |
340 | if (match(dev, data) && get_device(dev)) | 336 | if (match(dev, data) && get_device(dev)) |
341 | break; | 337 | break; |
@@ -388,9 +384,7 @@ struct device *subsys_find_device_by_id(struct bus_type *subsys, unsigned int id | |||
388 | return NULL; | 384 | return NULL; |
389 | 385 | ||
390 | if (hint) { | 386 | if (hint) { |
391 | if (klist_iter_init_node(&subsys->p->klist_devices, &i, | 387 | klist_iter_init_node(&subsys->p->klist_devices, &i, &hint->p->knode_bus); |
392 | &hint->p->knode_bus) < 0) | ||
393 | return NULL; | ||
394 | dev = next_device(&i); | 388 | dev = next_device(&i); |
395 | if (dev && dev->id == id && get_device(dev)) { | 389 | if (dev && dev->id == id && get_device(dev)) { |
396 | klist_iter_exit(&i); | 390 | klist_iter_exit(&i); |
@@ -452,13 +446,11 @@ int bus_for_each_drv(struct bus_type *bus, struct device_driver *start, | |||
452 | if (!bus) | 446 | if (!bus) |
453 | return -EINVAL; | 447 | return -EINVAL; |
454 | 448 | ||
455 | error = klist_iter_init_node(&bus->p->klist_drivers, &i, | 449 | klist_iter_init_node(&bus->p->klist_drivers, &i, |
456 | start ? &start->p->knode_bus : NULL); | 450 | start ? &start->p->knode_bus : NULL); |
457 | if (!error) { | 451 | while ((drv = next_driver(&i)) && !error) |
458 | while ((drv = next_driver(&i)) && !error) | 452 | error = fn(drv, data); |
459 | error = fn(drv, data); | 453 | klist_iter_exit(&i); |
460 | klist_iter_exit(&i); | ||
461 | } | ||
462 | return error; | 454 | return error; |
463 | } | 455 | } |
464 | EXPORT_SYMBOL_GPL(bus_for_each_drv); | 456 | EXPORT_SYMBOL_GPL(bus_for_each_drv); |
@@ -1119,19 +1111,15 @@ EXPORT_SYMBOL_GPL(bus_sort_breadthfirst); | |||
1119 | * otherwise if it is NULL, the iteration starts at the beginning of | 1111 | * otherwise if it is NULL, the iteration starts at the beginning of |
1120 | * the list. | 1112 | * the list. |
1121 | */ | 1113 | */ |
1122 | int subsys_dev_iter_init(struct subsys_dev_iter *iter, struct bus_type *subsys, | 1114 | void subsys_dev_iter_init(struct subsys_dev_iter *iter, struct bus_type *subsys, |
1123 | struct device *start, const struct device_type *type) | 1115 | struct device *start, const struct device_type *type) |
1124 | { | 1116 | { |
1125 | struct klist_node *start_knode = NULL; | 1117 | struct klist_node *start_knode = NULL; |
1126 | int error; | ||
1127 | 1118 | ||
1128 | if (start) | 1119 | if (start) |
1129 | start_knode = &start->p->knode_bus; | 1120 | start_knode = &start->p->knode_bus; |
1130 | error = klist_iter_init_node(&subsys->p->klist_devices, &iter->ki, | 1121 | klist_iter_init_node(&subsys->p->klist_devices, &iter->ki, start_knode); |
1131 | start_knode); | 1122 | iter->type = type; |
1132 | if (!error) | ||
1133 | iter->type = type; | ||
1134 | return error; | ||
1135 | } | 1123 | } |
1136 | EXPORT_SYMBOL_GPL(subsys_dev_iter_init); | 1124 | EXPORT_SYMBOL_GPL(subsys_dev_iter_init); |
1137 | 1125 | ||