From: Greg KH <greg@kroah.com>
To: linux-kernel@vger.kernel.org
Subject: [PATCH] Driver Core update and fixes for 2.6.1
Date: Mon, 19 Jan 2004 17:12:38 -0800 [thread overview]
Message-ID: <10745611583988@kroah.com> (raw)
In-Reply-To: <20040120011036.GA6162@kroah.com>
ChangeSet 1.1495, 2004/01/19 16:21:50-08:00, dtor_core@ameritech.net
[PATCH] kobject: make kobject hotplug function public
make kobject hotplug mechanism public so that others may call it.
include/linux/kobject.h | 1
lib/kobject.c | 49 ++++++++++++++++++++----------------------------
2 files changed, 22 insertions(+), 28 deletions(-)
diff -Nru a/include/linux/kobject.h b/include/linux/kobject.h
--- a/include/linux/kobject.h Mon Jan 19 17:05:23 2004
+++ b/include/linux/kobject.h Mon Jan 19 17:05:23 2004
@@ -56,6 +56,7 @@
extern struct kobject * kobject_get(struct kobject *);
extern void kobject_put(struct kobject *);
+extern void kobject_hotplug(const char *action, struct kobject *);
struct kobj_type {
void (*release)(struct kobject *);
diff -Nru a/lib/kobject.c b/lib/kobject.c
--- a/lib/kobject.c Mon Jan 19 17:05:23 2004
+++ b/lib/kobject.c Mon Jan 19 17:05:23 2004
@@ -198,9 +198,24 @@
kfree(envp);
return;
}
+
+void kobject_hotplug(const char *action, struct kobject *kobj)
+{
+ struct kobject * top_kobj = kobj;
+
+ /* If this kobj does not belong to a kset,
+ try to find a parent that does. */
+ if (!top_kobj->kset && top_kobj->parent) {
+ do {
+ top_kobj = top_kobj->parent;
+ } while (!top_kobj->kset && top_kobj->parent);
+ }
+
+ if (top_kobj->kset && top_kobj->kset->hotplug_ops)
+ kset_hotplug(action, top_kobj->kset, kobj);
+}
#else
-static void kset_hotplug(const char *action, struct kset *kset,
- struct kobject *kobj)
+void kobject_hotplug(const char *action, struct kobject *kobj)
{
return;
}
@@ -248,7 +263,6 @@
{
int error = 0;
struct kobject * parent;
- struct kobject * top_kobj;
if (!(kobj = kobject_get(kobj)))
return -ENOENT;
@@ -277,18 +291,9 @@
if (parent)
kobject_put(parent);
} else {
- /* If this kobj does not belong to a kset,
- try to find a parent that does. */
- top_kobj = kobj;
- if (!top_kobj->kset && top_kobj->parent) {
- do {
- top_kobj = top_kobj->parent;
- } while (!top_kobj->kset && top_kobj->parent);
- }
-
- if (top_kobj->kset && top_kobj->kset->hotplug_ops)
- kset_hotplug("add", top_kobj->kset, kobj);
+ kobject_hotplug("add", kobj);
}
+
return error;
}
@@ -396,20 +401,7 @@
void kobject_del(struct kobject * kobj)
{
- struct kobject * top_kobj;
-
- /* If this kobj does not belong to a kset,
- try to find a parent that does. */
- top_kobj = kobj;
- if (!top_kobj->kset && top_kobj->parent) {
- do {
- top_kobj = top_kobj->parent;
- } while (!top_kobj->kset && top_kobj->parent);
- }
-
- if (top_kobj->kset && top_kobj->kset->hotplug_ops)
- kset_hotplug("remove", top_kobj->kset, kobj);
-
+ kobject_hotplug("remove", kobj);
sysfs_remove_dir(kobj);
unlink(kobj);
}
@@ -638,6 +630,7 @@
EXPORT_SYMBOL(kobject_unregister);
EXPORT_SYMBOL(kobject_get);
EXPORT_SYMBOL(kobject_put);
+EXPORT_SYMBOL(kobject_hotplug);
EXPORT_SYMBOL(kset_register);
EXPORT_SYMBOL(kset_unregister);
next prev parent reply other threads:[~2004-01-20 1:16 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-01-20 1:10 [BK PATCH] Driver Core update for 2.6.1 Greg KH
2004-01-20 1:12 ` Greg KH [this message]
2004-01-20 1:12 ` [PATCH] Driver Core update and fixes " Greg KH
2004-01-20 1:12 ` Greg KH
2004-01-20 1:12 ` Greg KH
2004-01-20 1:12 ` Greg KH
2004-01-20 1:12 ` Greg KH
2004-01-20 1:12 ` Greg KH
2004-01-20 1:12 ` Greg KH
2004-01-20 1:12 ` Greg KH
2004-01-20 1:12 ` Greg KH
2004-01-20 1:12 ` Greg KH
2004-01-20 8:40 ` [BK PATCH] Driver Core update " Måns Rullgård
2004-01-20 11:13 ` Andreas Jellinghaus
2004-01-20 17:14 ` Greg KH
2004-01-20 17:48 ` Måns Rullgård
2004-01-21 0:10 ` Greg KH
2004-01-21 1:59 ` Måns Rullgård
2004-01-21 2:18 ` Greg KH
2004-01-21 18:39 ` Måns Rullgård
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=10745611583988@kroah.com \
--to=greg@kroah.com \
--cc=linux-kernel@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.