diff mbox

[U-Boot,v3,07/29] sandbox: Remove all drivers before exit

Message ID 1406120124-9373-8-git-send-email-sjg@chromium.org
State Accepted
Delegated to: Simon Glass
Headers show

Commit Message

Simon Glass July 23, 2014, 12:55 p.m. UTC
Drivers are supposed to be able to close down cleanly. To set a good example,
make sandbox shut down its driver model drivers and remove them before exit.

It may be desirable to do the same more generally once driver model is more
widely-used. This could be done during bootm, before U-Boot jumps to the OS.
It seems far too early to make this change.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

Changes in v3: None
Changes in v2: None

 arch/sandbox/cpu/cpu.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Simon Glass July 26, 2014, 3:04 p.m. UTC | #1
On 23 July 2014 13:55, Simon Glass <sjg@chromium.org> wrote:
> Drivers are supposed to be able to close down cleanly. To set a good example,
> make sandbox shut down its driver model drivers and remove them before exit.
>
> It may be desirable to do the same more generally once driver model is more
> widely-used. This could be done during bootm, before U-Boot jumps to the OS.
> It seems far too early to make this change.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>

Applied to dm/master.
diff mbox

Patch

diff --git a/arch/sandbox/cpu/cpu.c b/arch/sandbox/cpu/cpu.c
index 3f4005b..1aa397c 100644
--- a/arch/sandbox/cpu/cpu.c
+++ b/arch/sandbox/cpu/cpu.c
@@ -4,6 +4,7 @@ 
  */
 
 #include <common.h>
+#include <dm/root.h>
 #include <os.h>
 #include <asm/state.h>
 
@@ -14,6 +15,9 @@  void reset_cpu(ulong ignored)
 	if (state_uninit())
 		os_exit(2);
 
+	if (dm_uninit())
+		os_exit(2);
+
 	/* This is considered normal termination for now */
 	os_exit(0);
 }