From: Todd Poynor <tpoynor@mvista.com>
To: greg@kroah.com, linux-hotplug-devel@lists.sourceforge.net,
linux-kernel@vger.kernel.org
Subject: [PATCH] Synchronous hotplug for kobjects
Date: Mon, 10 May 2004 13:48:13 -0700 [thread overview]
Message-ID: <20040510204813.GA20691@dhcp193.mvista.com> (raw)
As discussed recently, it's expected to be useful to generate
synchronous hotplug events from the kobject subsystem in certain
situations. This patch adds a kobject_hotplug_wait function that issues
a synchronous call. The function should be used for appropriate actions
that require synchronous semantics; please note many hotplug events
would suffer severe performance degradation if issued synchronously, and
one should exercise caution in choosing to use this function.
--- linux-2.6.6-orig/include/linux/kobject.h 2004-05-10 11:23:55.000000000 -0700
+++ linux-2.6.6-pm/include/linux/kobject.h 2004-05-10 11:41:25.000000000 -0700
@@ -57,6 +57,7 @@
extern void kobject_put(struct kobject *);
extern void kobject_hotplug(const char *action, struct kobject *);
+extern void kobject_hotplug_wait(const char *action, struct kobject *);
struct kobj_type {
void (*release)(struct kobject *);
--- linux-2.6.6-orig/lib/kobject.c 2004-05-10 11:26:35.000000000 -0700
+++ linux-2.6.6-pm/lib/kobject.c 2004-05-10 13:20:35.389369032 -0700
@@ -104,7 +104,7 @@
static spinlock_t sequence_lock = SPIN_LOCK_UNLOCKED;
static void kset_hotplug(const char *action, struct kset *kset,
- struct kobject *kobj)
+ struct kobject *kobj, int wait)
{
char *argv [3];
char **envp = NULL;
@@ -185,9 +185,9 @@
}
}
- pr_debug ("%s: %s %s %s %s %s %s %s\n", __FUNCTION__, argv[0], argv[1],
- envp[0], envp[1], envp[2], envp[3], envp[4]);
- retval = call_usermodehelper (argv[0], argv, envp, 0);
+ pr_debug ("%s: %s %s %s %s %s %s %s %d\n", __FUNCTION__, argv[0], argv[1],
+ envp[0], envp[1], envp[2], envp[3], envp[4], wait);
+ retval = call_usermodehelper (argv[0], argv, envp, wait);
if (retval)
pr_debug ("%s - call_usermodehelper returned %d\n",
__FUNCTION__, retval);
@@ -199,7 +199,8 @@
return;
}
-void kobject_hotplug(const char *action, struct kobject *kobj)
+static void kobject_hotplug_flags(const char *action, struct kobject *kobj,
+ int wait)
{
struct kobject * top_kobj = kobj;
@@ -212,13 +213,27 @@
}
if (top_kobj->kset && top_kobj->kset->hotplug_ops)
- kset_hotplug(action, top_kobj->kset, kobj);
+ kset_hotplug(action, top_kobj->kset, kobj, wait);
+}
+
+void kobject_hotplug(const char *action, struct kobject *kobj)
+{
+ kobject_hotplug_flags(action, kobj, 0);
+}
+
+void kobject_hotplug_wait(const char *action, struct kobject *kobj)
+{
+ kobject_hotplug_flags(action, kobj, 1);
}
#else
void kobject_hotplug(const char *action, struct kobject *kobj)
{
return;
}
+void kobject_hotplug_wait(const char *action, struct kobject *kobj)
+{
+ return;
+}
#endif /* CONFIG_HOTPLUG */
/**
--
Todd Poynor
MontaVista Software
next reply other threads:[~2004-05-10 20:48 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-05-10 20:48 Todd Poynor [this message]
2004-05-10 21:19 ` Greg KH
2004-05-11 1:09 ` Todd Poynor
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=20040510204813.GA20691@dhcp193.mvista.com \
--to=tpoynor@mvista.com \
--cc=greg@kroah.com \
--cc=linux-hotplug-devel@lists.sourceforge.net \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®