9
0
Fork 0

driver: implement device_detect_by_name function

It becomes a common pattern for boards to find a device and
call device_detect on it. Add a convenience wrapper for it.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
Sascha Hauer 2013-06-26 07:40:49 +02:00
parent b70bfc27e6
commit 8d2762ff56
2 changed files with 11 additions and 0 deletions

View File

@ -100,6 +100,16 @@ int device_detect(struct device_d *dev)
return dev->detect(dev);
}
int device_detect_by_name(const char *devname)
{
struct device_d *dev = get_device_by_name(devname);
if (!dev)
return -ENODEV;
return device_detect(dev);
}
static int match(struct driver_d *drv, struct device_d *dev)
{
int ret;

View File

@ -159,6 +159,7 @@ int device_probe(struct device_d *dev);
/* detect devices attached to this device (cards, disks,...) */
int device_detect(struct device_d *dev);
int device_detect_by_name(const char *devname);
/* Unregister a device. This function can fail, e.g. when the device
* has children.