From: Jon Smirl <jonsmirl@gmail.com>
To: Greg KH <gregkh@suse.de>
Cc: Dmitry Torokhov <dtor_core@ameritech.net>,
linux-hotplug-devel@lists.sourceforge.net,
Vojtech Pavlik <vojtech@suse.cz>,
Kay Sievers <kay.sievers@vrfy.org>,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: Input sysbsystema and hotplug
Date: Tue, 14 Jun 2005 11:02:43 -0400 [thread overview]
Message-ID: <9e473391050614080230ae359d@mail.gmail.com> (raw)
In-Reply-To: <20050614063851.GA19620@suse.de>
On 6/14/05, Greg KH <gregkh@suse.de> wrote:
> Heh, yes, sorry, you did.
>
> Hm, I don't even remember why I didn't like it anymore, last I remember,
> I think you got the parent reference counting correct, right? Care to
> dig out the patch and send it again?
I brought this forward from a kernel a couple of months old so it may
need some checking.
diff --git a/drivers/base/class.c b/drivers/base/class.c
--- a/drivers/base/class.c
+++ b/drivers/base/class.c
@@ -406,8 +406,9 @@ int class_device_add(struct class_device
/* 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;
@@ -438,6 +439,12 @@ int class_device_add(struct class_device
return error;
}
+int class_device_add_child(struct class_device *class_dev, struct
class_device *parent)
+{
+ class_dev->kobj.parent = &class_dev->kobj;
+ return class_device_add(class_dev);
+}
+
int class_device_register(struct class_device *class_dev)
{
class_device_initialize(class_dev);
@@ -463,6 +470,7 @@ void class_device_del(struct class_devic
class_device_remove_attrs(class_dev);
kobject_hotplug(&class_dev->kobj, KOBJ_REMOVE);
+ kobject_put(class_dev->kobj.parent);
kobject_del(&class_dev->kobj);
if (parent)
@@ -581,6 +589,7 @@ EXPORT_SYMBOL_GPL(class_device_register)
EXPORT_SYMBOL_GPL(class_device_unregister);
EXPORT_SYMBOL_GPL(class_device_initialize);
EXPORT_SYMBOL_GPL(class_device_add);
+EXPORT_SYMBOL_GPL(class_device_add_child);
EXPORT_SYMBOL_GPL(class_device_del);
EXPORT_SYMBOL_GPL(class_device_get);
EXPORT_SYMBOL_GPL(class_device_put);
diff --git a/include/linux/device.h b/include/linux/device.h
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -208,6 +208,7 @@ extern int class_device_register(struct
extern void class_device_unregister(struct class_device *);
extern void class_device_initialize(struct class_device *);
extern int class_device_add(struct class_device *);
+extern int class_device_add_child(struct class_device *, struct
class_device *);
extern void class_device_del(struct class_device *);
extern int class_device_rename(struct class_device *, char *);
--
Jon Smirl
jonsmirl@gmail.com
next prev parent reply other threads:[~2005-06-14 15:13 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <200506131607.51736.dtor_core@ameritech.net>
2005-06-13 21:26 ` Input sysbsystema and hotplug Kay Sievers
2005-06-13 21:38 ` Dmitry Torokhov
2005-06-13 22:17 ` Greg KH
2005-06-14 6:14 ` Dmitry Torokhov
2005-06-13 21:58 ` Dmitry Torokhov
2005-06-13 22:05 ` Dmitry Torokhov
2005-06-13 22:15 ` Greg KH
2005-06-14 6:08 ` Dmitry Torokhov
2005-06-13 22:21 ` Kay Sievers
2005-06-14 7:32 ` Hannes Reinecke
2005-06-14 7:42 ` Dmitry Torokhov
2005-06-14 7:47 ` Hannes Reinecke
2005-06-14 7:56 ` Dmitry Torokhov
2005-06-19 14:46 ` David Brownell
2005-06-13 22:16 ` Greg KH
2005-06-14 4:26 ` Dmitry Torokhov
2005-06-14 6:21 ` Jon Smirl
2005-06-14 6:38 ` Greg KH
2005-06-14 13:41 ` Jon Smirl
2005-06-14 15:02 ` Jon Smirl [this message]
2005-06-14 18:16 ` Dmitry Torokhov
2005-06-14 7:43 ` Hannes Reinecke
2005-06-14 7:52 ` Dmitry Torokhov
2005-06-14 8:00 ` Hannes Reinecke
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=9e473391050614080230ae359d@mail.gmail.com \
--to=jonsmirl@gmail.com \
--cc=dtor_core@ameritech.net \
--cc=gregkh@suse.de \
--cc=kay.sievers@vrfy.org \
--cc=linux-hotplug-devel@lists.sourceforge.net \
--cc=linux-kernel@vger.kernel.org \
--cc=vojtech@suse.cz \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox