diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-01-09 18:30:54 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-01-09 18:31:07 -0500 |
commit | 0d34052dfeba307ebc18d2f672e80e3f419714d4 (patch) | |
tree | 8f7955328cd9700c443c33f88631449a0c1208fb /drivers | |
parent | f0fb2eb7bd76b9927f1350cfb0a3653385b82c6c (diff) | |
parent | 926beadb3dfaddccb3348a5b9e6c2a1f8290a220 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core-2.6:
Revert "driver core: create a private portion of struct device"
Revert "driver core: move klist_children into private structure"
Revert "driver core: move knode_driver into private structure"
Revert "driver core: move knode_bus into private structure"
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/base/base.h | 26 | ||||
-rw-r--r-- | drivers/base/bus.c | 40 | ||||
-rw-r--r-- | drivers/base/core.c | 45 | ||||
-rw-r--r-- | drivers/base/dd.c | 13 | ||||
-rw-r--r-- | drivers/base/driver.c | 13 |
5 files changed, 34 insertions, 103 deletions
diff --git a/drivers/base/base.h b/drivers/base/base.h index b676f8f801f8..0a5f055dffba 100644 --- a/drivers/base/base.h +++ b/drivers/base/base.h | |||
@@ -63,32 +63,6 @@ struct class_private { | |||
63 | #define to_class(obj) \ | 63 | #define to_class(obj) \ |
64 | container_of(obj, struct class_private, class_subsys.kobj) | 64 | container_of(obj, struct class_private, class_subsys.kobj) |
65 | 65 | ||
66 | /** | ||
67 | * struct device_private - structure to hold the private to the driver core portions of the device structure. | ||
68 | * | ||
69 | * @klist_children - klist containing all children of this device | ||
70 | * @knode_parent - node in sibling list | ||
71 | * @knode_driver - node in driver list | ||
72 | * @knode_bus - node in bus list | ||
73 | * @device - pointer back to the struct class that this structure is | ||
74 | * associated with. | ||
75 | * | ||
76 | * Nothing outside of the driver core should ever touch these fields. | ||
77 | */ | ||
78 | struct device_private { | ||
79 | struct klist klist_children; | ||
80 | struct klist_node knode_parent; | ||
81 | struct klist_node knode_driver; | ||
82 | struct klist_node knode_bus; | ||
83 | struct device *device; | ||
84 | }; | ||
85 | #define to_device_private_parent(obj) \ | ||
86 | container_of(obj, struct device_private, knode_parent) | ||
87 | #define to_device_private_driver(obj) \ | ||
88 | container_of(obj, struct device_private, knode_driver) | ||
89 | #define to_device_private_bus(obj) \ | ||
90 | container_of(obj, struct device_private, knode_bus) | ||
91 | |||
92 | /* initialisation functions */ | 66 | /* initialisation functions */ |
93 | extern int devices_init(void); | 67 | extern int devices_init(void); |
94 | extern int buses_init(void); | 68 | extern int buses_init(void); |
diff --git a/drivers/base/bus.c b/drivers/base/bus.c index 0f0a50444672..83f32b891fa9 100644 --- a/drivers/base/bus.c +++ b/drivers/base/bus.c | |||
@@ -253,14 +253,7 @@ static ssize_t store_drivers_probe(struct bus_type *bus, | |||
253 | static struct device *next_device(struct klist_iter *i) | 253 | static struct device *next_device(struct klist_iter *i) |
254 | { | 254 | { |
255 | struct klist_node *n = klist_next(i); | 255 | struct klist_node *n = klist_next(i); |
256 | struct device *dev = NULL; | 256 | return n ? container_of(n, struct device, knode_bus) : NULL; |
257 | struct device_private *dev_prv; | ||
258 | |||
259 | if (n) { | ||
260 | dev_prv = to_device_private_bus(n); | ||
261 | dev = dev_prv->device; | ||
262 | } | ||
263 | return dev; | ||
264 | } | 257 | } |
265 | 258 | ||
266 | /** | 259 | /** |
@@ -293,7 +286,7 @@ int bus_for_each_dev(struct bus_type *bus, struct device *start, | |||
293 | return -EINVAL; | 286 | return -EINVAL; |
294 | 287 | ||
295 | klist_iter_init_node(&bus->p->klist_devices, &i, | 288 | klist_iter_init_node(&bus->p->klist_devices, &i, |
296 | (start ? &start->p->knode_bus : NULL)); | 289 | (start ? &start->knode_bus : NULL)); |
297 | while ((dev = next_device(&i)) && !error) | 290 | while ((dev = next_device(&i)) && !error) |
298 | error = fn(dev, data); | 291 | error = fn(dev, data); |
299 | klist_iter_exit(&i); | 292 | klist_iter_exit(&i); |
@@ -327,7 +320,7 @@ struct device *bus_find_device(struct bus_type *bus, | |||
327 | return NULL; | 320 | return NULL; |
328 | 321 | ||
329 | klist_iter_init_node(&bus->p->klist_devices, &i, | 322 | klist_iter_init_node(&bus->p->klist_devices, &i, |
330 | (start ? &start->p->knode_bus : NULL)); | 323 | (start ? &start->knode_bus : NULL)); |
331 | while ((dev = next_device(&i))) | 324 | while ((dev = next_device(&i))) |
332 | if (match(dev, data) && get_device(dev)) | 325 | if (match(dev, data) && get_device(dev)) |
333 | break; | 326 | break; |
@@ -514,8 +507,7 @@ void bus_attach_device(struct device *dev) | |||
514 | ret = device_attach(dev); | 507 | ret = device_attach(dev); |
515 | WARN_ON(ret < 0); | 508 | WARN_ON(ret < 0); |
516 | if (ret >= 0) | 509 | if (ret >= 0) |
517 | klist_add_tail(&dev->p->knode_bus, | 510 | klist_add_tail(&dev->knode_bus, &bus->p->klist_devices); |
518 | &bus->p->klist_devices); | ||
519 | } | 511 | } |
520 | } | 512 | } |
521 | 513 | ||
@@ -536,8 +528,8 @@ void bus_remove_device(struct device *dev) | |||
536 | sysfs_remove_link(&dev->bus->p->devices_kset->kobj, | 528 | sysfs_remove_link(&dev->bus->p->devices_kset->kobj, |
537 | dev_name(dev)); | 529 | dev_name(dev)); |
538 | device_remove_attrs(dev->bus, dev); | 530 | device_remove_attrs(dev->bus, dev); |
539 | if (klist_node_attached(&dev->p->knode_bus)) | 531 | if (klist_node_attached(&dev->knode_bus)) |
540 | klist_del(&dev->p->knode_bus); | 532 | klist_del(&dev->knode_bus); |
541 | 533 | ||
542 | pr_debug("bus: '%s': remove device %s\n", | 534 | pr_debug("bus: '%s': remove device %s\n", |
543 | dev->bus->name, dev_name(dev)); | 535 | dev->bus->name, dev_name(dev)); |
@@ -839,16 +831,14 @@ static void bus_remove_attrs(struct bus_type *bus) | |||
839 | 831 | ||
840 | static void klist_devices_get(struct klist_node *n) | 832 | static void klist_devices_get(struct klist_node *n) |
841 | { | 833 | { |
842 | struct device_private *dev_prv = to_device_private_bus(n); | 834 | struct device *dev = container_of(n, struct device, knode_bus); |
843 | struct device *dev = dev_prv->device; | ||
844 | 835 | ||
845 | get_device(dev); | 836 | get_device(dev); |
846 | } | 837 | } |
847 | 838 | ||
848 | static void klist_devices_put(struct klist_node *n) | 839 | static void klist_devices_put(struct klist_node *n) |
849 | { | 840 | { |
850 | struct device_private *dev_prv = to_device_private_bus(n); | 841 | struct device *dev = container_of(n, struct device, knode_bus); |
851 | struct device *dev = dev_prv->device; | ||
852 | 842 | ||
853 | put_device(dev); | 843 | put_device(dev); |
854 | } | 844 | } |
@@ -1003,20 +993,18 @@ static void device_insertion_sort_klist(struct device *a, struct list_head *list | |||
1003 | { | 993 | { |
1004 | struct list_head *pos; | 994 | struct list_head *pos; |
1005 | struct klist_node *n; | 995 | struct klist_node *n; |
1006 | struct device_private *dev_prv; | ||
1007 | struct device *b; | 996 | struct device *b; |
1008 | 997 | ||
1009 | list_for_each(pos, list) { | 998 | list_for_each(pos, list) { |
1010 | n = container_of(pos, struct klist_node, n_node); | 999 | n = container_of(pos, struct klist_node, n_node); |
1011 | dev_prv = to_device_private_bus(n); | 1000 | b = container_of(n, struct device, knode_bus); |
1012 | b = dev_prv->device; | ||
1013 | if (compare(a, b) <= 0) { | 1001 | if (compare(a, b) <= 0) { |
1014 | list_move_tail(&a->p->knode_bus.n_node, | 1002 | list_move_tail(&a->knode_bus.n_node, |
1015 | &b->p->knode_bus.n_node); | 1003 | &b->knode_bus.n_node); |
1016 | return; | 1004 | return; |
1017 | } | 1005 | } |
1018 | } | 1006 | } |
1019 | list_move_tail(&a->p->knode_bus.n_node, list); | 1007 | list_move_tail(&a->knode_bus.n_node, list); |
1020 | } | 1008 | } |
1021 | 1009 | ||
1022 | void bus_sort_breadthfirst(struct bus_type *bus, | 1010 | void bus_sort_breadthfirst(struct bus_type *bus, |
@@ -1026,7 +1014,6 @@ void bus_sort_breadthfirst(struct bus_type *bus, | |||
1026 | LIST_HEAD(sorted_devices); | 1014 | LIST_HEAD(sorted_devices); |
1027 | struct list_head *pos, *tmp; | 1015 | struct list_head *pos, *tmp; |
1028 | struct klist_node *n; | 1016 | struct klist_node *n; |
1029 | struct device_private *dev_prv; | ||
1030 | struct device *dev; | 1017 | struct device *dev; |
1031 | struct klist *device_klist; | 1018 | struct klist *device_klist; |
1032 | 1019 | ||
@@ -1035,8 +1022,7 @@ void bus_sort_breadthfirst(struct bus_type *bus, | |||
1035 | spin_lock(&device_klist->k_lock); | 1022 | spin_lock(&device_klist->k_lock); |
1036 | list_for_each_safe(pos, tmp, &device_klist->k_list) { | 1023 | list_for_each_safe(pos, tmp, &device_klist->k_list) { |
1037 | n = container_of(pos, struct klist_node, n_node); | 1024 | n = container_of(pos, struct klist_node, n_node); |
1038 | dev_prv = to_device_private_bus(n); | 1025 | dev = container_of(n, struct device, knode_bus); |
1039 | dev = dev_prv->device; | ||
1040 | device_insertion_sort_klist(dev, &sorted_devices, compare); | 1026 | device_insertion_sort_klist(dev, &sorted_devices, compare); |
1041 | } | 1027 | } |
1042 | list_splice(&sorted_devices, &device_klist->k_list); | 1028 | list_splice(&sorted_devices, &device_klist->k_list); |
diff --git a/drivers/base/core.c b/drivers/base/core.c index 61df508fa62b..8079afca4972 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c | |||
@@ -109,7 +109,6 @@ static struct sysfs_ops dev_sysfs_ops = { | |||
109 | static void device_release(struct kobject *kobj) | 109 | static void device_release(struct kobject *kobj) |
110 | { | 110 | { |
111 | struct device *dev = to_dev(kobj); | 111 | struct device *dev = to_dev(kobj); |
112 | struct device_private *p = dev->p; | ||
113 | 112 | ||
114 | if (dev->release) | 113 | if (dev->release) |
115 | dev->release(dev); | 114 | dev->release(dev); |
@@ -121,7 +120,6 @@ static void device_release(struct kobject *kobj) | |||
121 | WARN(1, KERN_ERR "Device '%s' does not have a release() " | 120 | WARN(1, KERN_ERR "Device '%s' does not have a release() " |
122 | "function, it is broken and must be fixed.\n", | 121 | "function, it is broken and must be fixed.\n", |
123 | dev_name(dev)); | 122 | dev_name(dev)); |
124 | kfree(p); | ||
125 | } | 123 | } |
126 | 124 | ||
127 | static struct kobj_type device_ktype = { | 125 | static struct kobj_type device_ktype = { |
@@ -509,16 +507,14 @@ EXPORT_SYMBOL_GPL(device_schedule_callback_owner); | |||
509 | 507 | ||
510 | static void klist_children_get(struct klist_node *n) | 508 | static void klist_children_get(struct klist_node *n) |
511 | { | 509 | { |
512 | struct device_private *p = to_device_private_parent(n); | 510 | struct device *dev = container_of(n, struct device, knode_parent); |
513 | struct device *dev = p->device; | ||
514 | 511 | ||
515 | get_device(dev); | 512 | get_device(dev); |
516 | } | 513 | } |
517 | 514 | ||
518 | static void klist_children_put(struct klist_node *n) | 515 | static void klist_children_put(struct klist_node *n) |
519 | { | 516 | { |
520 | struct device_private *p = to_device_private_parent(n); | 517 | struct device *dev = container_of(n, struct device, knode_parent); |
521 | struct device *dev = p->device; | ||
522 | 518 | ||
523 | put_device(dev); | 519 | put_device(dev); |
524 | } | 520 | } |
@@ -540,15 +536,9 @@ static void klist_children_put(struct klist_node *n) | |||
540 | */ | 536 | */ |
541 | void device_initialize(struct device *dev) | 537 | void device_initialize(struct device *dev) |
542 | { | 538 | { |
543 | dev->p = kzalloc(sizeof(*dev->p), GFP_KERNEL); | ||
544 | if (!dev->p) { | ||
545 | WARN_ON(1); | ||
546 | return; | ||
547 | } | ||
548 | dev->p->device = dev; | ||
549 | dev->kobj.kset = devices_kset; | 539 | dev->kobj.kset = devices_kset; |
550 | kobject_init(&dev->kobj, &device_ktype); | 540 | kobject_init(&dev->kobj, &device_ktype); |
551 | klist_init(&dev->p->klist_children, klist_children_get, | 541 | klist_init(&dev->klist_children, klist_children_get, |
552 | klist_children_put); | 542 | klist_children_put); |
553 | INIT_LIST_HEAD(&dev->dma_pools); | 543 | INIT_LIST_HEAD(&dev->dma_pools); |
554 | init_MUTEX(&dev->sem); | 544 | init_MUTEX(&dev->sem); |
@@ -932,8 +922,7 @@ int device_add(struct device *dev) | |||
932 | kobject_uevent(&dev->kobj, KOBJ_ADD); | 922 | kobject_uevent(&dev->kobj, KOBJ_ADD); |
933 | bus_attach_device(dev); | 923 | bus_attach_device(dev); |
934 | if (parent) | 924 | if (parent) |
935 | klist_add_tail(&dev->p->knode_parent, | 925 | klist_add_tail(&dev->knode_parent, &parent->klist_children); |
936 | &parent->p->klist_children); | ||
937 | 926 | ||
938 | if (dev->class) { | 927 | if (dev->class) { |
939 | mutex_lock(&dev->class->p->class_mutex); | 928 | mutex_lock(&dev->class->p->class_mutex); |
@@ -1047,7 +1036,7 @@ void device_del(struct device *dev) | |||
1047 | device_pm_remove(dev); | 1036 | device_pm_remove(dev); |
1048 | dpm_sysfs_remove(dev); | 1037 | dpm_sysfs_remove(dev); |
1049 | if (parent) | 1038 | if (parent) |
1050 | klist_del(&dev->p->knode_parent); | 1039 | klist_del(&dev->knode_parent); |
1051 | if (MAJOR(dev->devt)) { | 1040 | if (MAJOR(dev->devt)) { |
1052 | device_remove_sys_dev_entry(dev); | 1041 | device_remove_sys_dev_entry(dev); |
1053 | device_remove_file(dev, &devt_attr); | 1042 | device_remove_file(dev, &devt_attr); |
@@ -1108,14 +1097,7 @@ void device_unregister(struct device *dev) | |||
1108 | static struct device *next_device(struct klist_iter *i) | 1097 | static struct device *next_device(struct klist_iter *i) |
1109 | { | 1098 | { |
1110 | struct klist_node *n = klist_next(i); | 1099 | struct klist_node *n = klist_next(i); |
1111 | struct device *dev = NULL; | 1100 | return n ? container_of(n, struct device, knode_parent) : NULL; |
1112 | struct device_private *p; | ||
1113 | |||
1114 | if (n) { | ||
1115 | p = to_device_private_parent(n); | ||
1116 | dev = p->device; | ||
1117 | } | ||
1118 | return dev; | ||
1119 | } | 1101 | } |
1120 | 1102 | ||
1121 | /** | 1103 | /** |
@@ -1137,7 +1119,7 @@ int device_for_each_child(struct device *parent, void *data, | |||
1137 | struct device *child; | 1119 | struct device *child; |
1138 | int error = 0; | 1120 | int error = 0; |
1139 | 1121 | ||
1140 | klist_iter_init(&parent->p->klist_children, &i); | 1122 | klist_iter_init(&parent->klist_children, &i); |
1141 | while ((child = next_device(&i)) && !error) | 1123 | while ((child = next_device(&i)) && !error) |
1142 | error = fn(child, data); | 1124 | error = fn(child, data); |
1143 | klist_iter_exit(&i); | 1125 | klist_iter_exit(&i); |
@@ -1168,7 +1150,7 @@ struct device *device_find_child(struct device *parent, void *data, | |||
1168 | if (!parent) | 1150 | if (!parent) |
1169 | return NULL; | 1151 | return NULL; |
1170 | 1152 | ||
1171 | klist_iter_init(&parent->p->klist_children, &i); | 1153 | klist_iter_init(&parent->klist_children, &i); |
1172 | while ((child = next_device(&i))) | 1154 | while ((child = next_device(&i))) |
1173 | if (match(child, data) && get_device(child)) | 1155 | if (match(child, data) && get_device(child)) |
1174 | break; | 1156 | break; |
@@ -1582,10 +1564,9 @@ int device_move(struct device *dev, struct device *new_parent) | |||
1582 | old_parent = dev->parent; | 1564 | old_parent = dev->parent; |
1583 | dev->parent = new_parent; | 1565 | dev->parent = new_parent; |
1584 | if (old_parent) | 1566 | if (old_parent) |
1585 | klist_remove(&dev->p->knode_parent); | 1567 | klist_remove(&dev->knode_parent); |
1586 | if (new_parent) { | 1568 | if (new_parent) { |
1587 | klist_add_tail(&dev->p->knode_parent, | 1569 | klist_add_tail(&dev->knode_parent, &new_parent->klist_children); |
1588 | &new_parent->p->klist_children); | ||
1589 | set_dev_node(dev, dev_to_node(new_parent)); | 1570 | set_dev_node(dev, dev_to_node(new_parent)); |
1590 | } | 1571 | } |
1591 | 1572 | ||
@@ -1597,11 +1578,11 @@ int device_move(struct device *dev, struct device *new_parent) | |||
1597 | device_move_class_links(dev, new_parent, old_parent); | 1578 | device_move_class_links(dev, new_parent, old_parent); |
1598 | if (!kobject_move(&dev->kobj, &old_parent->kobj)) { | 1579 | if (!kobject_move(&dev->kobj, &old_parent->kobj)) { |
1599 | if (new_parent) | 1580 | if (new_parent) |
1600 | klist_remove(&dev->p->knode_parent); | 1581 | klist_remove(&dev->knode_parent); |
1601 | dev->parent = old_parent; | 1582 | dev->parent = old_parent; |
1602 | if (old_parent) { | 1583 | if (old_parent) { |
1603 | klist_add_tail(&dev->p->knode_parent, | 1584 | klist_add_tail(&dev->knode_parent, |
1604 | &old_parent->p->klist_children); | 1585 | &old_parent->klist_children); |
1605 | set_dev_node(dev, dev_to_node(old_parent)); | 1586 | set_dev_node(dev, dev_to_node(old_parent)); |
1606 | } | 1587 | } |
1607 | } | 1588 | } |
diff --git a/drivers/base/dd.c b/drivers/base/dd.c index 6fdaf76f033f..315bed8d5e7f 100644 --- a/drivers/base/dd.c +++ b/drivers/base/dd.c | |||
@@ -28,7 +28,7 @@ | |||
28 | 28 | ||
29 | static void driver_bound(struct device *dev) | 29 | static void driver_bound(struct device *dev) |
30 | { | 30 | { |
31 | if (klist_node_attached(&dev->p->knode_driver)) { | 31 | if (klist_node_attached(&dev->knode_driver)) { |
32 | printk(KERN_WARNING "%s: device %s already bound\n", | 32 | printk(KERN_WARNING "%s: device %s already bound\n", |
33 | __func__, kobject_name(&dev->kobj)); | 33 | __func__, kobject_name(&dev->kobj)); |
34 | return; | 34 | return; |
@@ -41,7 +41,7 @@ static void driver_bound(struct device *dev) | |||
41 | blocking_notifier_call_chain(&dev->bus->p->bus_notifier, | 41 | blocking_notifier_call_chain(&dev->bus->p->bus_notifier, |
42 | BUS_NOTIFY_BOUND_DRIVER, dev); | 42 | BUS_NOTIFY_BOUND_DRIVER, dev); |
43 | 43 | ||
44 | klist_add_tail(&dev->p->knode_driver, &dev->driver->p->klist_devices); | 44 | klist_add_tail(&dev->knode_driver, &dev->driver->p->klist_devices); |
45 | } | 45 | } |
46 | 46 | ||
47 | static int driver_sysfs_add(struct device *dev) | 47 | static int driver_sysfs_add(struct device *dev) |
@@ -310,7 +310,7 @@ static void __device_release_driver(struct device *dev) | |||
310 | drv->remove(dev); | 310 | drv->remove(dev); |
311 | devres_release_all(dev); | 311 | devres_release_all(dev); |
312 | dev->driver = NULL; | 312 | dev->driver = NULL; |
313 | klist_remove(&dev->p->knode_driver); | 313 | klist_remove(&dev->knode_driver); |
314 | } | 314 | } |
315 | } | 315 | } |
316 | 316 | ||
@@ -340,7 +340,6 @@ EXPORT_SYMBOL_GPL(device_release_driver); | |||
340 | */ | 340 | */ |
341 | void driver_detach(struct device_driver *drv) | 341 | void driver_detach(struct device_driver *drv) |
342 | { | 342 | { |
343 | struct device_private *dev_prv; | ||
344 | struct device *dev; | 343 | struct device *dev; |
345 | 344 | ||
346 | for (;;) { | 345 | for (;;) { |
@@ -349,10 +348,8 @@ void driver_detach(struct device_driver *drv) | |||
349 | spin_unlock(&drv->p->klist_devices.k_lock); | 348 | spin_unlock(&drv->p->klist_devices.k_lock); |
350 | break; | 349 | break; |
351 | } | 350 | } |
352 | dev_prv = list_entry(drv->p->klist_devices.k_list.prev, | 351 | dev = list_entry(drv->p->klist_devices.k_list.prev, |
353 | struct device_private, | 352 | struct device, knode_driver.n_node); |
354 | knode_driver.n_node); | ||
355 | dev = dev_prv->device; | ||
356 | get_device(dev); | 353 | get_device(dev); |
357 | spin_unlock(&drv->p->klist_devices.k_lock); | 354 | spin_unlock(&drv->p->klist_devices.k_lock); |
358 | 355 | ||
diff --git a/drivers/base/driver.c b/drivers/base/driver.c index b76cc69f1106..1e2bda780e48 100644 --- a/drivers/base/driver.c +++ b/drivers/base/driver.c | |||
@@ -19,14 +19,7 @@ | |||
19 | static struct device *next_device(struct klist_iter *i) | 19 | static struct device *next_device(struct klist_iter *i) |
20 | { | 20 | { |
21 | struct klist_node *n = klist_next(i); | 21 | struct klist_node *n = klist_next(i); |
22 | struct device *dev = NULL; | 22 | return n ? container_of(n, struct device, knode_driver) : NULL; |
23 | struct device_private *dev_prv; | ||
24 | |||
25 | if (n) { | ||
26 | dev_prv = to_device_private_driver(n); | ||
27 | dev = dev_prv->device; | ||
28 | } | ||
29 | return dev; | ||
30 | } | 23 | } |
31 | 24 | ||
32 | /** | 25 | /** |
@@ -49,7 +42,7 @@ int driver_for_each_device(struct device_driver *drv, struct device *start, | |||
49 | return -EINVAL; | 42 | return -EINVAL; |
50 | 43 | ||
51 | klist_iter_init_node(&drv->p->klist_devices, &i, | 44 | klist_iter_init_node(&drv->p->klist_devices, &i, |
52 | start ? &start->p->knode_driver : NULL); | 45 | start ? &start->knode_driver : NULL); |
53 | while ((dev = next_device(&i)) && !error) | 46 | while ((dev = next_device(&i)) && !error) |
54 | error = fn(dev, data); | 47 | error = fn(dev, data); |
55 | klist_iter_exit(&i); | 48 | klist_iter_exit(&i); |
@@ -83,7 +76,7 @@ struct device *driver_find_device(struct device_driver *drv, | |||
83 | return NULL; | 76 | return NULL; |
84 | 77 | ||
85 | klist_iter_init_node(&drv->p->klist_devices, &i, | 78 | klist_iter_init_node(&drv->p->klist_devices, &i, |
86 | (start ? &start->p->knode_driver : NULL)); | 79 | (start ? &start->knode_driver : NULL)); |
87 | while ((dev = next_device(&i))) | 80 | while ((dev = next_device(&i))) |
88 | if (match(dev, data) && get_device(dev)) | 81 | if (match(dev, data) && get_device(dev)) |
89 | break; | 82 | break; |