On Mon, 2005-08-22 at 17:39 -0700, Patrick Mansfield wrote:
> But, we have to pass in a struct kref, to affect put/get_device, correct?

Correct.  Let me post the code mods to drivers/base/core.c so you can
see how it works.

Incidentally, it now passes your dev_child test without causing a slab
corruption.

James

diff --git a/drivers/base/core.c b/drivers/base/core.c
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -191,6 +191,20 @@ void device_remove_file(struct device * 
        }
 }
 
+static void klist_children_get(struct klist_node *n)
+{
+       struct device *dev = container_of(n, struct device, knode_parent);
+
+       get_device(dev);
+}
+
+static void klist_children_put(struct klist_node *n)
+{
+       struct device *dev = container_of(n, struct device, knode_parent);
+
+       put_device(dev);
+}
+
 
 /**
  *     device_initialize - init device structure.
@@ -207,7 +221,8 @@ void device_initialize(struct device *de
 {
        kobj_set_kset_s(dev, devices_subsys);
        kobject_init(&dev->kobj);
-       klist_init(&dev->klist_children);
+       klist_init_embedded(&dev->klist_children, klist_children_get,
+                           klist_children_put);
        INIT_LIST_HEAD(&dev->dma_pools);
        init_MUTEX(&dev->sem);
 }


-
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to