[PATCH 2/4] exitcall: move device_shutdown to exitcall infrastructure

Herve Codina Herve.CODINA at celad.com
Mon Jul 6 00:36:44 PDT 2015


Signed-off-by: Herve Codina <Herve.CODINA at celad.com>
---
 common/startup.c      |    1 -
 drivers/base/driver.c |    3 ++-
 include/driver.h      |    5 -----
 3 files changed, 2 insertions(+), 7 deletions(-)

diff --git a/common/startup.c b/common/startup.c
index 676e435..e9ab248 100644
--- a/common/startup.c
+++ b/common/startup.c
@@ -151,7 +151,6 @@ void shutdown_barebox(void)
 		(*exitcall)();
 	}
 	
-	devices_shutdown();
 #ifdef ARCH_SHUTDOWN
 	arch_shutdown();
 #endif
diff --git a/drivers/base/driver.c b/drivers/base/driver.c
index 338bea1..943deb4 100644
--- a/drivers/base/driver.c
+++ b/drivers/base/driver.c
@@ -459,7 +459,7 @@ const char *dev_id(const struct device_d *dev)
 	return buf;
 }
 
-void devices_shutdown(void)
+static void devices_shutdown(void)
 {
 	struct device_d *dev;
 
@@ -468,6 +468,7 @@ void devices_shutdown(void)
 			dev->bus->remove(dev);
 	}
 }
+devshutdown_exitcall(devices_shutdown);
 
 int dev_get_drvdata(struct device_d *dev, const void **data)
 {
diff --git a/include/driver.h b/include/driver.h
index d0cdcc9..d862ed0 100644
--- a/include/driver.h
+++ b/include/driver.h
@@ -339,11 +339,6 @@ int mem_memmap(struct cdev *cdev, void **map, int flags);
 /* Use this if you have nothing to do in your drivers probe function */
 int dummy_probe(struct device_d *);
 
-/* Iterate over all activated devices (i.e. the ones with drivers and shut
- * them down.
- */
-void devices_shutdown(void);
-
 int generic_memmap_ro(struct cdev *dev, void **map, int flags);
 int generic_memmap_rw(struct cdev *dev, void **map, int flags);
 
-- 
1.7.9.5




More information about the barebox mailing list