All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 1/5 v2] dm: device_remove: Don't return in device_chld_remove() upon error
@ 2017-04-24  7:48 Stefan Roese
  2017-04-24  7:48 ` [U-Boot] [PATCH 2/5 v2] serial: serial-uclass: Use force parameter in stdio_deregister_dev() Stefan Roese
                   ` (4 more replies)
  0 siblings, 5 replies; 22+ messages in thread
From: Stefan Roese @ 2017-04-24  7:48 UTC (permalink / raw)
  To: u-boot

On my x86 platform I've noticed, that calling dm_uninit() or the new
function dm_remove_devices_flags() does not remove the desired device at
all. Debugging showed, that the serial uclass returns -EPERM in
serial_pre_remove() and this leads to a complete stop of the device
removal pretty early, as the serial device is one of the first ones in
the DM. Here the dm tree output:

=> dm tree
 Class       Probed   Name
----------------------------------------
 root        [ + ]    root_driver
 rsa_mod_exp [   ]    |-- mod_exp_sw
 serial      [ + ]    |-- serial
 rtc         [   ]    |-- rtc
 timer       [ + ]    |-- tsc-timer
 syscon      [ + ]    |-- pch_pinctrl
 ...

In this example, device_remove(root) will stop directly after trying to
remove the "serial" device.

To solve this problem, this patch removes the return upon error check in
the device_remove() call in device_chld_remove(). This leads to
device_chld_remove() continuing with the device_remove() call to the
following child devices.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Bin Meng <bmeng.cn@gmail.com>
---
v2:
- Add debug() output in error case

 drivers/core/device-remove.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/core/device-remove.c b/drivers/core/device-remove.c
index cc0043b990..a1c0103af0 100644
--- a/drivers/core/device-remove.c
+++ b/drivers/core/device-remove.c
@@ -58,8 +58,14 @@ static int device_chld_remove(struct udevice *dev, uint flags)
 
 	list_for_each_entry_safe(pos, n, &dev->child_head, sibling_node) {
 		ret = device_remove(pos, flags);
-		if (ret)
-			return ret;
+		/*
+		 * Don't stop on error here, the remaining child devices still
+		 * need to get removed.
+		 */
+		if (ret) {
+			debug("%s: device_remove(%s) returned %d\n",
+			      __func__, pos->name, ret);
+		}
 	}
 
 	return 0;
-- 
2.12.2

^ permalink raw reply related	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2017-05-15  3:02 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-24  7:48 [U-Boot] [PATCH 1/5 v2] dm: device_remove: Don't return in device_chld_remove() upon error Stefan Roese
2017-04-24  7:48 ` [U-Boot] [PATCH 2/5 v2] serial: serial-uclass: Use force parameter in stdio_deregister_dev() Stefan Roese
2017-04-29  0:26   ` Simon Glass
2017-05-09  4:28     ` Bin Meng
2017-04-24  7:48 ` [U-Boot] [PATCH 3/5 v2] dm: core: Add DM_FLAG_OS_PREPARE flag Stefan Roese
2017-05-09  4:28   ` Bin Meng
2017-04-24  7:48 ` [U-Boot] [PATCH 4/5 v2] x86: bootm: Add dm_remove_devices_flags() call to bootm_announce_and_cleanup() Stefan Roese
2017-05-09  4:28   ` Bin Meng
2017-04-24  7:48 ` [U-Boot] [PATCH 5/5 v2] spi: ich: Configure SPI BIOS parameters for Linux upon U-Boot exit Stefan Roese
2017-05-09  4:28   ` Bin Meng
2017-05-09 11:14   ` Jagan Teki
2017-05-09 11:20     ` Stefan Roese
2017-05-10  0:47       ` Bin Meng
2017-05-10 12:31         ` Stefan Roese
2017-05-15  3:02         ` Simon Glass
2017-04-29  0:26 ` [U-Boot] [PATCH 1/5 v2] dm: device_remove: Don't return in device_chld_remove() upon error Simon Glass
2017-05-01  6:14   ` Stefan Roese
2017-05-02 11:27     ` Simon Glass
2017-05-02 11:45       ` Stefan Roese
2017-05-04 16:50         ` Simon Glass
2017-05-08  7:35           ` Stefan Roese
2017-05-09  3:20             ` Simon Glass

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.