summaryrefslogtreecommitdiffstats
path: root/common/startup.c
diff options
context:
space:
mode:
authorHerve Codina <Herve.CODINA@celad.com>2015-07-06 09:36:43 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2015-07-13 08:28:19 +0200
commita2136e6cbd732e627f9f33d9211ba0a67be52889 (patch)
treec1aff563dc89e01ed4a801ec7045b19e00041de5 /common/startup.c
parentd46b6785c4bcd3ceb7d90895e9f44a7bf7d6757d (diff)
downloadbarebox-a2136e6cbd732e627f9f33d9211ba0a67be52889.tar.gz
barebox-a2136e6cbd732e627f9f33d9211ba0a67be52889.tar.xz
exitcall: Add exitcall infrastructure
exitcall infrastructure is based on initcall infrastructure. It allows to have and use exit call hooks on barebox shutdown. Signed-off-by: Herve Codina <Herve.CODINA@celad.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'common/startup.c')
-rw-r--r--common/startup.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/common/startup.c b/common/startup.c
index 6178fc5353..45d8d86aee 100644
--- a/common/startup.c
+++ b/common/startup.c
@@ -45,6 +45,9 @@
extern initcall_t __barebox_initcalls_start[], __barebox_early_initcalls_end[],
__barebox_initcalls_end[];
+extern exitcall_t __barebox_exitcalls_start[], __barebox_exitcalls_end[];
+
+
#if defined CONFIG_FS_RAMFS && defined CONFIG_FS_DEVFS
static int mount_root(void)
{
@@ -140,6 +143,14 @@ void (*board_shutdown)(void);
*/
void shutdown_barebox(void)
{
+ exitcall_t *exitcall;
+
+ for (exitcall = __barebox_exitcalls_start;
+ exitcall < __barebox_exitcalls_end; exitcall++) {
+ pr_debug("exitcall-> %pS\n", *exitcall);
+ (*exitcall)();
+ }
+
devices_shutdown();
#ifdef ARCH_SHUTDOWN
arch_shutdown();