From: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
To: barebox@lists.infradead.org
Subject: [PATCH 1/7] driver: introduce device_probe to manully probe a device
Date: Sun, 18 Nov 2012 13:49:39 +0100 [thread overview]
Message-ID: <1353242985-7539-1-git-send-email-plagnioj@jcrosoft.com> (raw)
In-Reply-To: <20121118124627.GE8327@game.jcrosoft.org>
This will expect a driver to be specified
This is needed by the phylib the probe the generic phy if not driver found
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
drivers/base/driver.c | 23 +++++++++++++++++------
include/driver.h | 5 +++++
2 files changed, 22 insertions(+), 6 deletions(-)
diff --git a/drivers/base/driver.c b/drivers/base/driver.c
index dc2df91..1f4031a 100644
--- a/drivers/base/driver.c
+++ b/drivers/base/driver.c
@@ -75,6 +75,21 @@ int get_free_deviceid(const char *name_template)
};
}
+int device_probe(struct device_d *dev)
+{
+ int ret;
+
+ ret = dev->bus->probe(dev);
+ if (ret) {
+ dev_err(dev, "probe failed: %s\n", strerror(-ret));
+ return ret;
+ }
+
+ list_add(&dev->active, &active);
+
+ return 0;
+}
+
static int match(struct driver_d *drv, struct device_d *dev)
{
int ret;
@@ -86,13 +101,9 @@ static int match(struct driver_d *drv, struct device_d *dev)
if (dev->bus->match(dev, drv))
goto err_out;
- ret = dev->bus->probe(dev);
- if (ret) {
- dev_err(dev, "probe failed: %s\n", strerror(-ret));
+ ret = device_probe(dev);
+ if (ret)
goto err_out;
- }
-
- list_add(&dev->active, &active);
return 0;
err_out:
diff --git a/include/driver.h b/include/driver.h
index f8d815c..a085981 100644
--- a/include/driver.h
+++ b/include/driver.h
@@ -148,6 +148,11 @@ struct driver_d {
int register_driver(struct driver_d *);
int register_device(struct device_d *);
+/* manualy probe a device
+ * the driver need to be specified
+ */
+int device_probe(struct device_d *dev);
+
/* Unregister a device. This function can fail, e.g. when the device
* has children.
*/
--
1.7.10.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2012-11-18 12:51 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-18 12:46 [PATCH 0/7] phylib: fix + drivers Jean-Christophe PLAGNIOL-VILLARD
2012-11-18 12:49 ` Jean-Christophe PLAGNIOL-VILLARD [this message]
2012-11-18 12:49 ` [PATCH 2/7] phylib: fix generic phy driver probe Jean-Christophe PLAGNIOL-VILLARD
2012-11-18 12:49 ` [PATCH 3/7] mdio_bus: fix match Jean-Christophe PLAGNIOL-VILLARD
2012-11-18 12:49 ` [PATCH 4/7] phylib: export phy_id via param Jean-Christophe PLAGNIOL-VILLARD
2012-11-18 12:49 ` [PATCH 5/7] phylib: introduction of forced 100Mbps Jean-Christophe PLAGNIOL-VILLARD
2012-11-18 12:49 ` [PATCH 6/7] phylib: add fixup support Jean-Christophe PLAGNIOL-VILLARD
2012-11-18 12:49 ` [PATCH 7/7] phylib: add micrel support Jean-Christophe PLAGNIOL-VILLARD
2012-11-20 8:39 ` [PATCH 0/7] phylib: fix + drivers Sascha Hauer
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=1353242985-7539-1-git-send-email-plagnioj@jcrosoft.com \
--to=plagnioj@jcrosoft.com \
--cc=barebox@lists.infradead.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