]> nv-tegra.nvidia Code Review - linux-2.6.git/commitdiff
[PATCH] klist: fix klist to have the same klist_add semantics as list_head
authorJames Bottomley <James.Bottomley@SteelEye.com>
Fri, 19 Aug 2005 13:14:01 +0000 (09:14 -0400)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 5 Sep 2005 23:03:13 +0000 (16:03 -0700)
at the moment, the list_head semantics are

list_add(node, head)

whereas current klist semantics are

klist_add(head, node)

This is bound to cause confusion, and since klist is the newcomer, it
should follow the list_head semantics.

I also added missing include guards to klist.h

Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/base/bus.c
drivers/base/core.c
drivers/base/dd.c
include/linux/klist.h
lib/klist.c

index 6966aff74efe5a07c76478affebdcafbc021f5df..17e96698410e43c47464fb6d509cf082b0a0a724 100644 (file)
@@ -360,7 +360,7 @@ int bus_add_device(struct device * dev)
        if (bus) {
                pr_debug("bus %s: add device %s\n", bus->name, dev->bus_id);
                device_attach(dev);
-               klist_add_tail(&bus->klist_devices, &dev->knode_bus);
+               klist_add_tail(&dev->knode_bus, &bus->klist_devices);
                error = device_add_attrs(bus, dev);
                if (!error) {
                        sysfs_create_link(&bus->devices.kobj, &dev->kobj, dev->bus_id);
@@ -448,7 +448,7 @@ int bus_add_driver(struct device_driver * drv)
                }
 
                driver_attach(drv);
-               klist_add_tail(&bus->klist_drivers, &drv->knode_bus);
+               klist_add_tail(&drv->knode_bus, &bus->klist_drivers);
                module_add_driver(drv->owner, drv);
 
                driver_add_attrs(bus, drv);
index efe03a024a5bc39bf958881143d740312c3b09bc..c8a33df007612b1e417744a262ba3fe1026114dd 100644 (file)
@@ -249,7 +249,7 @@ int device_add(struct device *dev)
        if ((error = bus_add_device(dev)))
                goto BusError;
        if (parent)
-               klist_add_tail(&parent->klist_children, &dev->knode_parent);
+               klist_add_tail(&dev->knode_parent, &parent->klist_children);
 
        /* notify platform of device entry */
        if (platform_notify)
index 16323f9cbff08fb066f8d10cda4bb76cfe711564..d5bbce38282fd233f06ef77891257a399be2471e 100644 (file)
@@ -42,7 +42,7 @@ void device_bind_driver(struct device * dev)
 {
        pr_debug("bound device '%s' to driver '%s'\n",
                 dev->bus_id, dev->driver->name);
-       klist_add_tail(&dev->driver->klist_devices, &dev->knode_driver);
+       klist_add_tail(&dev->knode_driver, &dev->driver->klist_devices);
        sysfs_create_link(&dev->driver->kobj, &dev->kobj,
                          kobject_name(&dev->kobj));
        sysfs_create_link(&dev->kobj, &dev->driver->kobj, "driver");
index eebf5e5696ec3b31323303a354026507b54ded52..c4d1fae4dd89a5a74ba95b1f8b8d6cd21a9edb1f 100644 (file)
@@ -9,6 +9,9 @@
  *     This file is rleased under the GPL v2.
  */
 
+#ifndef _LINUX_KLIST_H
+#define _LINUX_KLIST_H
+
 #include <linux/spinlock.h>
 #include <linux/completion.h>
 #include <linux/kref.h>
@@ -31,8 +34,8 @@ struct klist_node {
        struct completion       n_removed;
 };
 
-extern void klist_add_tail(struct klist * k, struct klist_node * n);
-extern void klist_add_head(struct klist * k, struct klist_node * n);
+extern void klist_add_tail(struct klist_node * n, struct klist * k);
+extern void klist_add_head(struct klist_node * n, struct klist * k);
 
 extern void klist_del(struct klist_node * n);
 extern void klist_remove(struct klist_node * n);
@@ -53,3 +56,4 @@ extern void klist_iter_init_node(struct klist * k, struct klist_iter * i,
 extern void klist_iter_exit(struct klist_iter * i);
 extern struct klist_node * klist_next(struct klist_iter * i);
 
+#endif
index 738ab810160a85b1c437da82e0389d354c76cf20..a70c836c5c4c2617f6929407034a8706b57c4886 100644 (file)
@@ -79,11 +79,11 @@ static void klist_node_init(struct klist * k, struct klist_node * n)
 
 /**
  *     klist_add_head - Initialize a klist_node and add it to front.
- *     @k:     klist it's going on.
  *     @n:     node we're adding.
+ *     @k:     klist it's going on.
  */
 
-void klist_add_head(struct klist * k, struct klist_node * n)
+void klist_add_head(struct klist_node * n, struct klist * k)
 {
        klist_node_init(k, n);
        add_head(k, n);
@@ -94,11 +94,11 @@ EXPORT_SYMBOL_GPL(klist_add_head);
 
 /**
  *     klist_add_tail - Initialize a klist_node and add it to back.
- *     @k:     klist it's going on.
  *     @n:     node we're adding.
+ *     @k:     klist it's going on.
  */
 
-void klist_add_tail(struct klist * k, struct klist_node * n)
+void klist_add_tail(struct klist_node * n, struct klist * k)
 {
        klist_node_init(k, n);
        add_tail(k, n);