From: Bill Gatliff <bgat@billgatliff.com>
To: Linux/PPC Development <linuxppc-dev@ozlabs.org>,
linux-embedded <linux-embedded@vger.kernel.org>
Subject: Re: A better way to sequence driver initialization?
Date: Fri, 09 Apr 2010 23:19:52 -0500 [thread overview]
Message-ID: <4BBFFC68.8000801@billgatliff.com> (raw)
In-Reply-To: <4BBFF789.3030201@billgatliff.com>
Bill Gatliff wrote:
>
> ... and kset_register() might be the only place that calls
> wake_up_interruptible(). Wow.
>
Wow, indeed. With just the attached patch, I get exactly one OOPS
now--- in ssc_free(), which I think is getting called because
atmel_ssc_modinit() is racing with something.
I wasn't able to get all the way to mounting my NFS rootfs, I think
because I'm getting to ip_auto_config() before my ethernet controller
has registered! :)
$ git diff lib/kobject.c
diff --git a/lib/kobject.c b/lib/kobject.c
index b512b74..e75556c 100644
--- a/lib/kobject.c
+++ b/lib/kobject.c
@@ -18,6 +18,10 @@
#include <linux/stat.h>
#include <linux/slab.h>
+#include <linux/sched.h>
+#include <linux/wait.h>
+DECLARE_WAIT_QUEUE_HEAD(kset_wait);
+
/*
* populate_dir - populate directory with attributes.
* @kobj: object we're working on.
@@ -721,6 +725,7 @@ int kset_register(struct kset *k)
if (err)
return err;
kobject_uevent(&k->kobj, KOBJ_ADD);
+ wake_up_interruptible(&kset_wait);
return 0;
}
@@ -744,7 +749,7 @@ void kset_unregister(struct kset *k)
* looking for a matching kobject. If matching object is found
* take a reference and return the object.
*/
-struct kobject *kset_find_obj(struct kset *kset, const char *name)
+struct kobject *__kset_find_obj(struct kset *kset, const char *name)
{
struct kobject *k;
struct kobject *ret = NULL;
@@ -760,6 +765,14 @@ struct kobject *kset_find_obj(struct kset *kset,
const char *name)
return ret;
}
+struct kobject *kset_find_obj(struct kset *kset, const char *name)
+{
+ struct kobject *ret = NULL;
+ wait_event_interruptible(kset_wait, (ret = __kset_find_obj(kset,
name)));
+ return ret;
+}
+
static void kset_release(struct kobject *kobj)
{
struct kset *kset = container_of(kobj, struct kset, kobj);
b.g.
--
Bill Gatliff
bgat@billgatliff.com
next prev parent reply other threads:[~2010-04-10 4:19 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-09 19:23 A better way to sequence driver initialization? Bill Gatliff
2010-04-10 3:54 ` Bill Gatliff
2010-04-10 3:59 ` Bill Gatliff
2010-04-10 4:19 ` Bill Gatliff [this message]
2010-04-10 5:29 ` Grant Likely
2010-04-10 13:56 ` Bill Gatliff
2010-04-10 8:53 ` Benjamin Herrenschmidt
2010-04-10 13:35 ` Bill Gatliff
2010-04-10 23:39 ` Paul Mundt
2010-04-10 23:47 ` Grant Likely
2010-04-11 1:33 ` Bill Gatliff
2010-04-11 1:47 ` Paul Mundt
2010-04-11 3:30 ` Bill Gatliff
2010-04-11 1:31 ` Bill Gatliff
2010-04-11 7:26 ` Benjamin Herrenschmidt
2010-04-11 7:18 ` Benjamin Herrenschmidt
2010-04-11 7:15 ` Benjamin Herrenschmidt
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=4BBFFC68.8000801@billgatliff.com \
--to=bgat@billgatliff.com \
--cc=linux-embedded@vger.kernel.org \
--cc=linuxppc-dev@ozlabs.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;
as well as URLs for NNTP newsgroup(s).