diff mbox

[U-Boot,RFC,04/22] dm: Provide a way to shut down driver model

Message ID 1400966481-14131-5-git-send-email-sjg@chromium.org
State RFC
Headers show

Commit Message

Simon Glass May 24, 2014, 9:21 p.m. UTC
Add a new method which removes and unbinds all drivers.

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

 drivers/core/root.c | 8 ++++++++
 include/dm/root.h   | 8 ++++++++
 2 files changed, 16 insertions(+)

Comments

Marek Vasut June 1, 2014, 5:34 p.m. UTC | #1
On Saturday, May 24, 2014 at 11:21:03 PM, Simon Glass wrote:
> Add a new method which removes and unbinds all drivers.
> 
> Signed-off-by: Simon Glass <sjg@chromium.org>

Acked-by: Marek Vasut <marex@denx.de>

Best regards,
Marek Vasut
diff mbox

Patch

diff --git a/drivers/core/root.c b/drivers/core/root.c
index 9fff164..4873e7b 100644
--- a/drivers/core/root.c
+++ b/drivers/core/root.c
@@ -55,6 +55,14 @@  int dm_init(void)
 	return 0;
 }
 
+int dm_uninit(void)
+{
+	device_remove(dm_root());
+	device_unbind(dm_root());
+
+	return 0;
+}
+
 int dm_scan_platdata(void)
 {
 	int ret;
diff --git a/include/dm/root.h b/include/dm/root.h
index 0ebccda..069d058 100644
--- a/include/dm/root.h
+++ b/include/dm/root.h
@@ -50,4 +50,12 @@  int dm_scan_fdt(const void *blob);
  */
 int dm_init(void);
 
+/**
+ * dm_uninit - Uninitialise Driver Model structures
+ *
+ * All devices will be removed and unbound
+ * @return 0 if OK, -ve on error
+ */
+int dm_uninit(void);
+
 #endif