diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2015-03-16 13:02:20 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2015-03-17 07:24:45 +0100 |
commit | 0f3366ba853dafc6c2005771bcd1a97769f764dd (patch) | |
tree | deba5daa63615de079b9f4957fb5e237fc6230c6 /drivers/base | |
parent | a76c62f80d95860e6c5904ab5cb91667c43f61eb (diff) | |
download | barebox-0f3366ba853dafc6c2005771bcd1a97769f764dd.tar.gz barebox-0f3366ba853dafc6c2005771bcd1a97769f764dd.tar.xz |
driver: fix device remove order
The active list is supposed to collect active devices in the
opposite order they are probed. This is used to remove the
devices in the correct order in devices_shutdown. The order
is wrong though when in a drivers probe function other devices
are registered. To get the order right we have to add the new
device to the active list before it is probed.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/base')
-rw-r--r-- | drivers/base/driver.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/base/driver.c b/drivers/base/driver.c index 3363b56675..453966b84f 100644 --- a/drivers/base/driver.c +++ b/drivers/base/driver.c @@ -85,14 +85,15 @@ int device_probe(struct device_d *dev) pinctrl_select_state_default(dev); + list_add(&dev->active, &active); + ret = dev->bus->probe(dev); if (ret) { + list_del(&dev->active); dev_err(dev, "probe failed: %s\n", strerror(-ret)); return ret; } - list_add(&dev->active, &active); - return 0; } |