diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2024-02-21 07:43:45 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2024-02-21 07:43:45 +0100 |
commit | b4186752c6abece215a27bfad014164accfe3e28 (patch) | |
tree | 93ce5759621a38204051216da38299f108dac661 /commands | |
parent | b83407415e5a2d28a7876b936f1c682d62a0372a (diff) | |
parent | bf816209a317dba723f3fbc23428f00f3ffa601a (diff) | |
download | barebox-b4186752c6abece215a27bfad014164accfe3e28.tar.gz barebox-b4186752c6abece215a27bfad014164accfe3e28.tar.xz |
Merge branch 'for-next/misc'
Diffstat (limited to 'commands')
-rw-r--r-- | commands/devunbind.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/commands/devunbind.c b/commands/devunbind.c index dab7f834db..d30193b285 100644 --- a/commands/devunbind.c +++ b/commands/devunbind.c @@ -20,9 +20,14 @@ static int do_devunbind(int argc, char *argv[]) break; case 'l': list_for_each_entry(dev, &active_device_list, active) { + void *rm_dev; + BUG_ON(!dev->driver); - if (dev->bus->remove) - printf("%pS(%s, %s)\n", dev->bus->remove, + + rm_dev = dev->bus->remove ?: dev->driver->remove; + + if (rm_dev) + printf("%pS(%s, %s)\n", rm_dev, dev->driver->name, dev_name(dev)); } return 0; @@ -47,13 +52,12 @@ static int do_devunbind(int argc, char *argv[]) continue; } - if (!dev->driver || !dev->bus->remove) { - printf("skipping unbound %s\n", argv[i]); + if (!device_remove(dev)) { + printf("no remove callback registered for %s\n", argv[i]); ret = COMMAND_ERROR; continue; } - dev->bus->remove(dev); dev->driver = NULL; list_del(&dev->active); } |