From: Ming Lei <ming.lei@canonical.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
Takashi Iwai <tiwai@suse.de>, Alan Cox <alan@lxorguk.ukuu.org.uk>,
Benjamin Herrenschmidt <benh@kernel.crashing.org>,
linux-kernel@vger.kernel.org, Ming Lei <ming.lei@canonical.com>
Subject: [RFC PATCH 1/5] driver core: driver probe at the last minute in driver_register
Date: Sun, 9 Sep 2012 07:25:16 +0800 [thread overview]
Message-ID: <1347146720-28596-2-git-send-email-ming.lei@canonical.com> (raw)
In-Reply-To: <1347146720-28596-1-git-send-email-ming.lei@canonical.com>
It should be correct to probe driver at the last minute in
driver_register since it will be so in !auto_probe case and
driver_register on no matched devices case.
Signed-off-by: Ming Lei <ming.lei@canonical.com>
---
drivers/base/bus.c | 5 -----
drivers/base/driver.c | 4 ++++
2 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/drivers/base/bus.c b/drivers/base/bus.c
index 181ed26..00d841d 100644
--- a/drivers/base/bus.c
+++ b/drivers/base/bus.c
@@ -714,11 +714,6 @@ int bus_add_driver(struct device_driver *drv)
if (error)
goto out_unregister;
- if (drv->bus->p->drivers_autoprobe) {
- error = driver_attach(drv);
- if (error)
- goto out_unregister;
- }
klist_add_tail(&priv->knode_bus, &bus->p->klist_drivers);
module_add_driver(drv->owner, drv);
diff --git a/drivers/base/driver.c b/drivers/base/driver.c
index 974e301..27f4c85 100644
--- a/drivers/base/driver.c
+++ b/drivers/base/driver.c
@@ -191,6 +191,10 @@ int driver_register(struct device_driver *drv)
}
kobject_uevent(&drv->p->kobj, KOBJ_ADD);
+ /* driver probe at the last minute */
+ if (drv->bus->p->drivers_autoprobe)
+ ret = driver_attach(drv);
+
return ret;
}
EXPORT_SYMBOL_GPL(driver_register);
--
1.7.9.5
next prev parent reply other threads:[~2012-09-08 23:26 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-08 23:25 [RFC PATCH 0/5] driver core: driver probe asynchronously Ming Lei
2012-09-08 23:25 ` Ming Lei [this message]
2012-09-08 23:25 ` [RFC PATCH 2/5] driver core: introduce driver_register_sync helper Ming Lei
2012-09-08 23:25 ` [RFC PATCH 3/5] driver core: platform: apply driver_register_sync for platform_driver_probe Ming Lei
2012-09-08 23:25 ` [RFC PATCH 4/5] driver core: remove __must_check on declaration of driver_attach Ming Lei
2012-09-08 23:25 ` [RFC PATCH 5/5] driver core: implement asynchorous probe() inside driver_register Ming Lei
2012-09-09 2:57 ` [RFC PATCH 0/5] driver core: driver probe asynchronously Greg Kroah-Hartman
2012-09-09 7:47 ` Benjamin Herrenschmidt
2012-09-09 7:56 ` Takashi Iwai
2012-09-09 10:44 ` Ming Lei
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=1347146720-28596-2-git-send-email-ming.lei@canonical.com \
--to=ming.lei@canonical.com \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=benh@kernel.crashing.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tiwai@suse.de \
--cc=torvalds@linux-foundation.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