aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/base/bus.c4
-rw-r--r--drivers/base/core.c2
-rw-r--r--drivers/base/dd.c2
-rw-r--r--include/linux/klist.h8
-rw-r--r--lib/klist.c8
5 files changed, 14 insertions, 10 deletions
diff --git a/drivers/base/bus.c b/drivers/base/bus.c
index 6966aff74efe..17e96698410e 100644
--- a/drivers/base/bus.c
+++ b/drivers/base/bus.c
@@ -360,7 +360,7 @@ int bus_add_device(struct device * dev)
360 if (bus) { 360 if (bus) {
361 pr_debug("bus %s: add device %s\n", bus->name, dev->bus_id); 361 pr_debug("bus %s: add device %s\n", bus->name, dev->bus_id);
362 device_attach(dev); 362 device_attach(dev);
363 klist_add_tail(&bus->klist_devices, &dev->knode_bus); 363 klist_add_tail(&dev->knode_bus, &bus->klist_devices);
364 error = device_add_attrs(bus, dev); 364 error = device_add_attrs(bus, dev);
365 if (!error) { 365 if (!error) {
366 sysfs_create_link(&bus->devices.kobj, &dev->kobj, dev->bus_id); 366 sysfs_create_link(&bus->devices.kobj, &dev->kobj, dev->bus_id);
@@ -448,7 +448,7 @@ int bus_add_driver(struct device_driver * drv)
448 } 448 }
449 449
450 driver_attach(drv); 450 driver_attach(drv);
451 klist_add_tail(&bus->klist_drivers, &drv->knode_bus); 451 klist_add_tail(&drv->knode_bus, &bus->klist_drivers);
452 module_add_driver(drv->owner, drv); 452 module_add_driver(drv->owner, drv);
453 453
454 driver_add_attrs(bus, drv); 454 driver_add_attrs(bus, drv);
diff --git a/drivers/base/core.c b/drivers/base/core.c
index efe03a024a5b..c8a33df00761 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -249,7 +249,7 @@ int device_add(struct device *dev)
249 if ((error = bus_add_device(dev))) 249 if ((error = bus_add_device(dev)))
250 goto BusError; 250 goto BusError;
251 if (parent) 251 if (parent)
252 klist_add_tail(&parent->klist_children, &dev->knode_parent); 252 klist_add_tail(&dev->knode_parent, &parent->klist_children);
253 253
254 /* notify platform of device entry */ 254 /* notify platform of device entry */
255 if (platform_notify) 255 if (platform_notify)
diff --git a/drivers/base/dd.c b/drivers/base/dd.c
index 16323f9cbff0..d5bbce38282f 100644
--- a/drivers/base/dd.c
+++ b/drivers/base/dd.c
@@ -42,7 +42,7 @@ void device_bind_driver(struct device * dev)
42{ 42{
43 pr_debug("bound device '%s' to driver '%s'\n", 43 pr_debug("bound device '%s' to driver '%s'\n",
44 dev->bus_id, dev->driver->name); 44 dev->bus_id, dev->driver->name);
45 klist_add_tail(&dev->driver->klist_devices, &dev->knode_driver); 45 klist_add_tail(&dev->knode_driver, &dev->driver->klist_devices);
46 sysfs_create_link(&dev->driver->kobj, &dev->kobj, 46 sysfs_create_link(&dev->driver->kobj, &dev->kobj,
47 kobject_name(&dev->kobj)); 47 kobject_name(&dev->kobj));
48 sysfs_create_link(&dev->kobj, &dev->driver->kobj, "driver"); 48 sysfs_create_link(&dev->kobj, &dev->driver->kobj, "driver");
diff --git a/include/linux/klist.h b/include/linux/klist.h
index eebf5e5696ec..c4d1fae4dd89 100644
--- a/include/linux/klist.h
+++ b/include/linux/klist.h
@@ -9,6 +9,9 @@
9 * This file is rleased under the GPL v2. 9 * This file is rleased under the GPL v2.
10 */ 10 */
11 11
12#ifndef _LINUX_KLIST_H
13#define _LINUX_KLIST_H
14
12#include <linux/spinlock.h> 15#include <linux/spinlock.h>
13#include <linux/completion.h> 16#include <linux/completion.h>
14#include <linux/kref.h> 17#include <linux/kref.h>
@@ -31,8 +34,8 @@ struct klist_node {
31 struct completion n_removed; 34 struct completion n_removed;
32}; 35};
33 36
34extern void klist_add_tail(struct klist * k, struct klist_node * n); 37extern void klist_add_tail(struct klist_node * n, struct klist * k);
35extern void klist_add_head(struct klist * k, struct klist_node * n); 38extern void klist_add_head(struct klist_node * n, struct klist * k);
36 39
37extern void klist_del(struct klist_node * n); 40extern void klist_del(struct klist_node * n);
38extern void klist_remove(struct klist_node * n); 41extern void klist_remove(struct klist_node * n);
@@ -53,3 +56,4 @@ extern void klist_iter_init_node(struct klist * k, struct klist_iter * i,
53extern void klist_iter_exit(struct klist_iter * i); 56extern void klist_iter_exit(struct klist_iter * i);
54extern struct klist_node * klist_next(struct klist_iter * i); 57extern struct klist_node * klist_next(struct klist_iter * i);
55 58
59#endif
diff --git a/lib/klist.c b/lib/klist.c
index 738ab810160a..a70c836c5c4c 100644
--- a/lib/klist.c
+++ b/lib/klist.c
@@ -79,11 +79,11 @@ static void klist_node_init(struct klist * k, struct klist_node * n)
79 79
80/** 80/**
81 * klist_add_head - Initialize a klist_node and add it to front. 81 * klist_add_head - Initialize a klist_node and add it to front.
82 * @k: klist it's going on.
83 * @n: node we're adding. 82 * @n: node we're adding.
83 * @k: klist it's going on.
84 */ 84 */
85 85
86void klist_add_head(struct klist * k, struct klist_node * n) 86void klist_add_head(struct klist_node * n, struct klist * k)
87{ 87{
88 klist_node_init(k, n); 88 klist_node_init(k, n);
89 add_head(k, n); 89 add_head(k, n);
@@ -94,11 +94,11 @@ EXPORT_SYMBOL_GPL(klist_add_head);
94 94
95/** 95/**
96 * klist_add_tail - Initialize a klist_node and add it to back. 96 * klist_add_tail - Initialize a klist_node and add it to back.
97 * @k: klist it's going on.
98 * @n: node we're adding. 97 * @n: node we're adding.
98 * @k: klist it's going on.
99 */ 99 */
100 100
101void klist_add_tail(struct klist * k, struct klist_node * n) 101void klist_add_tail(struct klist_node * n, struct klist * k)
102{ 102{
103 klist_node_init(k, n); 103 klist_node_init(k, n);
104 add_tail(k, n); 104 add_tail(k, n);