dm: Provide a way to shut down driver model
authorSimon Glass <sjg@chromium.org>
Wed, 23 Jul 2014 12:55:01 +0000 (06:55 -0600)
committerSimon Glass <sjg@chromium.org>
Wed, 23 Jul 2014 13:07:24 +0000 (14:07 +0100)
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>
drivers/core/root.c
include/dm/root.h

index ac1c1648f30dbdc6f6ce168290381c48020784e1..346d462470e34716f2b3c8f930cce4d938c3f19d 100644 (file)
@@ -56,6 +56,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;
index a4826a6e3cc485abeb619604c13ac4767abe6184..35818b1deedcc895c38795b2d2237bae30d18a4b 100644 (file)
@@ -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