mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Greg KH <greg@kroah.com>
To: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Driver Core patches for 2.6.10-rc1
Date: Fri, 22 Oct 2004 16:09:31 -0700	[thread overview]
Message-ID: <10984865712455@kroah.com> (raw)
In-Reply-To: <10984865713952@kroah.com>

ChangeSet 1.2020, 2004/10/22 14:29:19-07:00, akpm@osdl.org

[PATCH] kobject_hotplug: permit no hotplug_ops

Make kobject_hotplug() work even if the kobject's kset doesn't implement any
hotplug_ops.

Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>


 lib/kobject_uevent.c |   19 ++++++++++++-------
 1 files changed, 12 insertions(+), 7 deletions(-)


diff -Nru a/lib/kobject_uevent.c b/lib/kobject_uevent.c
--- a/lib/kobject_uevent.c	2004-10-22 16:00:04 -07:00
+++ b/lib/kobject_uevent.c	2004-10-22 16:00:04 -07:00
@@ -187,6 +187,8 @@
 	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 {
@@ -194,15 +196,18 @@
 		} 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;
 	}
 
@@ -221,8 +226,8 @@
 	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;
 
@@ -256,9 +261,9 @@
 	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) {


  reply	other threads:[~2004-10-23  3:28 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-10-22 23:09 [BK PATCH] " Greg KH
2004-10-22 23:09 ` [PATCH] " Greg KH
2004-10-22 23:09   ` Greg KH
2004-10-22 23:09     ` Greg KH
2004-10-22 23:09       ` Greg KH [this message]
2004-10-22 23:09         ` Greg KH
2004-10-22 23:09           ` Greg KH
2004-10-22 23:09             ` Greg KH
2004-11-01 21:54 [BK PATCH] " Greg KH
2004-11-01 21:57 ` [PATCH] " Greg KH
2004-11-01 21:57   ` Greg KH
2004-11-01 21:57     ` Greg KH
2004-11-01 21:57       ` Greg KH
2004-11-01 21:57         ` Greg KH
2004-11-01 21:57           ` Greg KH
2004-11-01 21:57             ` Greg KH
2004-11-01 21:57               ` Greg KH
2004-11-01 21:57                 ` Greg KH
2004-11-01 21:57                   ` Greg KH
2004-11-01 21:57                     ` Greg KH
2004-11-01 21:57                       ` Greg KH
2004-11-01 21:57                         ` Greg KH
2004-11-01 21:57                           ` Greg KH
2004-11-02 22:32                   ` Russell King
2004-11-07 15:28                     ` Russell King
2004-11-10  1:37                       ` Greg KH
2004-11-10  2:57                         ` Paul Mackerras
2004-11-10  8:36                           ` Russell King
2004-11-10 21:36                             ` Paul Mackerras
2004-11-11  0:00                               ` Nigel Cunningham
2004-11-11 20:52                               ` Russell King
2004-11-12  0:28                               ` Greg KH
2004-11-01 23:44       ` Pozsar Balazs

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=10984865712455@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome