From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jon Smirl Date: Mon, 28 Feb 2005 21:13:23 +0000 Subject: Re: event sequencing Message-Id: <9e473391050228131367fc2203@mail.gmail.com> List-Id: References: <9e473391050225081838f673c7@mail.gmail.com> In-Reply-To: <9e473391050225081838f673c7@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: linux-hotplug@vger.kernel.org On Mon, 28 Feb 2005 11:56:43 -0800, Greg KH wrote: > I like the idea of your patch, but I think it breaks when we remove the > class_device device, right? Or if we remove the parent class_device > first. Added code to inc the parent's ref count. BTW if parent is NULL the later call to class_device_add_attrs(class_dev); is going to trap. [jonsmirl@jonsmirl base]$ bk diffs -u === class.c 1.57 vs edited ==--- 1.57/drivers/base/class.c 2004-12-21 19:29:34 -05:00 +++ edited/class.c 2005-02-28 16:10:04 -05:00 @@ -417,8 +417,9 @@ /* first, register with generic layer. */ kobject_set_name(&class_dev->kobj, "%s", class_dev->class_id); - if (parent) + if (parent && !class_dev->kobj.parent) class_dev->kobj.parent = &parent->subsys.kset.kobj; + class_dev->kobj.parent = kobject_get(class_dev->kobj.parent); if ((error = kobject_add(&class_dev->kobj))) goto register_done; @@ -467,6 +468,7 @@ class_device_driver_unlink(class_dev); class_device_remove_attrs(class_dev); + kobject_put(class_dev->kobj.parent); kobject_del(&class_dev->kobj); if (parent) [jonsmirl@jonsmirl base]$ -- Jon Smirl jonsmirl@gmail.com ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_ide95&alloc_id396&op=click _______________________________________________ Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net Linux-hotplug-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel