From 9fdfadf8fc83b173b3ba55aa82739ca92d8a273d Mon Sep 17 00:00:00 2001 From: Stephen Warren Date: Tue, 19 Apr 2016 16:19:29 -0600 Subject: dm: core: allow drivers to refuse to bind In some cases, drivers may not want to bind to a device. Allow bind() to return -ENODEV in this case, and don't treat this as an error. This can be useful in situations where some information source other than the DT node's main status property indicates whether the device should be enabled, for example other DT properties might indicate this, or the driver might query non-DT sources such as system fuses or a version number register. Signed-off-by: Stephen Warren Reviewed-by: Simon Glass --- drivers/core/lists.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'drivers/core') diff --git a/drivers/core/lists.c b/drivers/core/lists.c index c4fc216340d..a72db13a119 100644 --- a/drivers/core/lists.c +++ b/drivers/core/lists.c @@ -171,6 +171,10 @@ int lists_bind_fdt(struct udevice *parent, const void *blob, int offset, dm_dbg(" - found match at '%s'\n", entry->name); ret = device_bind(parent, entry, name, NULL, offset, &dev); + if (ret == -ENODEV) { + dm_dbg("Driver '%s' refuses to bind\n", entry->name); + continue; + } if (ret) { dm_warn("Error binding driver '%s': %d\n", entry->name, ret); -- cgit v1.2.3