summaryrefslogtreecommitdiff
path: root/drivers/base
diff options
context:
space:
mode:
authorAhmad Fatoum <a.fatoum@pengutronix.de>2022-01-13 17:04:14 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2022-01-14 08:52:44 +0100
commit90244aef72993fb8771213f1a63b862ca8d8c695 (patch)
tree930f193ff7d65cf3419dbfe16d8f47572a393385 /drivers/base
parent3f256724b98fb3784a6caf3cff77f957d46bead9 (diff)
downloadbarebox-90244aef72993fb8771213f1a63b862ca8d8c695.tar.gz
commands: add new devunbind debugging command
Memory corruption around device removal may go unnoticed, because barebox is shutting down anyway and doing no new allocations. Add a new devunbind command that should help with debugging such issues by allowing selective unbinding and removal of devices. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20220113160414.3943151-3-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/base')
-rw-r--r--drivers/base/driver.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/base/driver.c b/drivers/base/driver.c
index bb07e96dca..f54f4d0b37 100644
--- a/drivers/base/driver.c
+++ b/drivers/base/driver.c
@@ -41,7 +41,8 @@ EXPORT_SYMBOL(device_list);
LIST_HEAD(driver_list);
EXPORT_SYMBOL(driver_list);
-static LIST_HEAD(active);
+LIST_HEAD(active_device_list);
+EXPORT_SYMBOL(active_device_list);
static LIST_HEAD(deferred);
struct device_d *get_device_by_name(const char *name)
@@ -91,7 +92,7 @@ int device_probe(struct device_d *dev)
pinctrl_select_state_default(dev);
of_clk_set_defaults(dev->device_node, false);
- list_add(&dev->active, &active);
+ list_add(&dev->active, &active_device_list);
ret = dev->bus->probe(dev);
if (ret == 0)
@@ -504,7 +505,7 @@ static void devices_shutdown(void)
struct device_d *dev;
int depth = 0;
- list_for_each_entry(dev, &active, active) {
+ list_for_each_entry(dev, &active_device_list, active) {
if (dev->bus->remove) {
depth++;
pr_report_probe("%*sremove-> %s\n", depth * 4, "", dev_name(dev));