summaryrefslogtreecommitdiffstats
path: root/drivers/base
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2013-05-24 15:42:27 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2013-05-31 12:32:05 +0200
commit95e7982f99c03806b640c2e98e3e8e29ecefa3f1 (patch)
tree9549784580f7a6924c276353754162f647d4b255 /drivers/base
parent9897dec869bfc54f704fd07dc85800aad2e37250 (diff)
downloadbarebox-95e7982f99c03806b640c2e98e3e8e29ecefa3f1.tar.gz
barebox-95e7982f99c03806b640c2e98e3e8e29ecefa3f1.tar.xz
devices: add detect mechanism
We often encounter the situation where slow devices should not be probed during startup since probing is slow and maybe unnecessary for unused devices. With MMC we have the 'probe' device parameter, for ata we have the same, for USB we have the 'usb' command. Overall this is not very consistent. With MMC there is the additional problem that the probe parameter is attached to the logical device when we often have the information which physical device we want to probe. This patch adds a 'detect' callback for devices and adds a command to detect devices and to list the devices which are actually detecable. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/base')
-rw-r--r--drivers/base/driver.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/base/driver.c b/drivers/base/driver.c
index c8856304f5..810d0011f6 100644
--- a/drivers/base/driver.c
+++ b/drivers/base/driver.c
@@ -93,6 +93,13 @@ int device_probe(struct device_d *dev)
return 0;
}
+int device_detect(struct device_d *dev)
+{
+ if (!dev->detect)
+ return -ENOSYS;
+ return dev->detect(dev);
+}
+
static int match(struct driver_d *drv, struct device_d *dev)
{
int ret;