From: Andrew Morton <akpm@osdl.org>
To: Keshavamurthy Anil S <anil.s.keshavamurthy@intel.com>
Cc: jeffpc@optonline.net, linux-kernel@vger.kernel.org,
torvalds@osdl.org, trivial@rustcorp.com.au,
rusty@rustcorp.com.au, greg@kroah.com
Subject: Re: [PATCH 2.6][resend] Add DEVPATH env variable to hotplug helper call
Date: Tue, 5 Oct 2004 10:18:23 -0700 [thread overview]
Message-ID: <20041005101823.223573d9.akpm@osdl.org> (raw)
In-Reply-To: <20041005012556.A22721@unix-os.sc.intel.com>
Keshavamurthy Anil S <anil.s.keshavamurthy@intel.com> wrote:
>
> Here is what I have come up with(please take a look at this patch).
> I was successfully able to get rid of cpu_run_sbin_hotplug() function, but
> when I call kobject_hotplug() function, it is finding
> top_kobj->kset->hotplug_ops set to NULL and hence returns without calling
> call_usermodehelper(). Not sure if this is a bug in kobject_hotplug(),
> I feel kobject_hotplug() function should continue even if
> top_kobj->kset-hotplug_ops is NULL.
Yes, it doesn't seem necessary. We could give cpu_sysdev_class a
valid-but-empty hotplug_ops but it seems simpler and more general to do it
in kobject_hotplug().
Make kobject_hotplug() work even if the kobject's kset doesn't implement any
hotplug_ops.
Signed-off-by: Andrew Morton <akpm@osdl.org>
---
25-akpm/lib/kobject_uevent.c | 19 ++++++++++++-------
1 files changed, 12 insertions(+), 7 deletions(-)
diff -puN lib/kobject_uevent.c~kobject_hotplug-no-hotplug_ops lib/kobject_uevent.c
--- 25/lib/kobject_uevent.c~kobject_hotplug-no-hotplug_ops 2004-10-05 10:11:59.404291240 -0700
+++ 25-akpm/lib/kobject_uevent.c 2004-10-05 10:13:59.132089848 -0700
@@ -191,6 +191,8 @@ void kobject_hotplug(struct kobject *kob
u64 seq;
struct kobject *top_kobj = kobj;
struct kset *kset;
+ static struct kset_hotplug_ops null_hotplug_ops;
+ struct kset_hotplug_ops *hotplug_ops = &null_hotplug_ops;
if (!top_kobj->kset && top_kobj->parent) {
do {
@@ -198,15 +200,18 @@ void kobject_hotplug(struct kobject *kob
} while (!top_kobj->kset && top_kobj->parent);
}
- if (top_kobj->kset && top_kobj->kset->hotplug_ops)
+ if (top_kobj->kset)
kset = top_kobj->kset;
else
return;
+ if (kset->hotplug_ops)
+ hotplug_ops = kset->hotplug_ops;
+
/* If the kset has a filter operation, call it.
Skip the event, if the filter returns zero. */
- if (kset->hotplug_ops->filter) {
- if (!kset->hotplug_ops->filter(kset, kobj))
+ if (hotplug_ops->filter) {
+ if (!hotplug_ops->filter(kset, kobj))
return;
}
@@ -225,8 +230,8 @@ void kobject_hotplug(struct kobject *kob
if (!buffer)
goto exit;
- if (kset->hotplug_ops->name)
- name = kset->hotplug_ops->name(kset, kobj);
+ if (hotplug_ops->name)
+ name = hotplug_ops->name(kset, kobj);
if (name == NULL)
name = kset->kobj.name;
@@ -260,9 +265,9 @@ void kobject_hotplug(struct kobject *kob
envp [i++] = scratch;
scratch += sprintf(scratch, "SUBSYSTEM=%s", name) + 1;
- if (kset->hotplug_ops->hotplug) {
+ if (hotplug_ops->hotplug) {
/* have the kset specific function add its stuff */
- retval = kset->hotplug_ops->hotplug (kset, kobj,
+ retval = hotplug_ops->hotplug (kset, kobj,
&envp[i], NUM_ENVP - i, scratch,
BUFFER_SIZE - (scratch - buffer));
if (retval) {
_
next prev parent reply other threads:[~2004-10-05 17:21 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-10-03 10:08 [PATCH 2.6][resend] Add DEVPATH env variable to hotplug helper call Josef 'Jeff' Sipek
2004-10-03 23:20 ` Andrew Morton
2004-10-04 17:22 ` Keshavamurthy Anil S
2004-10-04 19:37 ` Andrew Morton
2004-10-04 19:43 ` Keshavamurthy Anil S
2004-10-05 8:25 ` Keshavamurthy Anil S
2004-10-05 17:18 ` Andrew Morton [this message]
2004-10-05 17:27 ` Keshavamurthy Anil S
2004-10-05 17:47 ` Andrew Morton
2004-10-05 18:01 ` Keshavamurthy Anil S
2004-10-05 18:23 ` Andrew Morton
2004-10-05 19:02 ` Keshavamurthy Anil S
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=20041005101823.223573d9.akpm@osdl.org \
--to=akpm@osdl.org \
--cc=anil.s.keshavamurthy@intel.com \
--cc=greg@kroah.com \
--cc=jeffpc@optonline.net \
--cc=linux-kernel@vger.kernel.org \
--cc=rusty@rustcorp.com.au \
--cc=torvalds@osdl.org \
--cc=trivial@rustcorp.com.au \
/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