From: Simon Glass Date: Wed, 23 Jul 2014 12:55:01 +0000 (-0600) Subject: dm: Provide a way to shut down driver model X-Git-Tag: v2014.10-rc1~70 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=9adbd7a116d62349eb0a85b5a08ab3ff0a12d556;p=u-boot dm: Provide a way to shut down driver model Add a new method which removes and unbinds all drivers. Signed-off-by: Simon Glass Acked-by: Marek Vasut --- diff --git a/drivers/core/root.c b/drivers/core/root.c index ac1c1648f3..346d462470 100644 --- a/drivers/core/root.c +++ b/drivers/core/root.c @@ -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; diff --git a/include/dm/root.h b/include/dm/root.h index a4826a6e3c..35818b1dee 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