Commit 9fdfadf8fc83b173b3ba55aa82739ca92d8a273d

Authored by Stephen Warren
Committed by Simon Glass
1 parent f79f1e0c0e

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 <swarren@nvidia.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

Showing 1 changed file with 4 additions and 0 deletions Side-by-side Diff

drivers/core/lists.c
... ... @@ -171,6 +171,10 @@
171 171  
172 172 dm_dbg(" - found match at '%s'\n", entry->name);
173 173 ret = device_bind(parent, entry, name, NULL, offset, &dev);
  174 + if (ret == -ENODEV) {
  175 + dm_dbg("Driver '%s' refuses to bind\n", entry->name);
  176 + continue;
  177 + }
174 178 if (ret) {
175 179 dm_warn("Error binding driver '%s': %d\n", entry->name,
176 180 ret);