diff options
author | Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> | 2012-11-18 13:49:39 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2012-11-20 09:38:25 +0100 |
commit | f777b3b13fab090ad0f340c626c05176b4bf226d (patch) | |
tree | ff061c6be6d851acbaa82c1504c088879a7549d3 /drivers/base | |
parent | c81154671253d730ad159db136235bfe2111d2db (diff) | |
download | barebox-f777b3b13fab090ad0f340c626c05176b4bf226d.tar.gz barebox-f777b3b13fab090ad0f340c626c05176b4bf226d.tar.xz |
driver: introduce device_probe to manully probe a device
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>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/base')
-rw-r--r-- | drivers/base/driver.c | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/drivers/base/driver.c b/drivers/base/driver.c index dc2df91522..1f4031ac9a 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: |