summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2017-03-13 12:05:23 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2017-03-30 08:23:21 +0200
commitdc247478c67d663b6e3f5ce639e06b23b54e6aff (patch)
tree7414c9d540c5d4600d161cf0bb72ccbd0e3da564 /include
parent441e9f5a72b245b671118f3e771eb129834a7a34 (diff)
downloadbarebox-dc247478c67d663b6e3f5ce639e06b23b54e6aff.tar.gz
barebox-dc247478c67d663b6e3f5ce639e06b23b54e6aff.tar.xz
poweroff: Allow to register poweroff handlers
Allow to register handlers for poweroff. This allows to have multiple poweroff implementations in a single binary. The implementation is close to the restart handlers. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'include')
-rw-r--r--include/common.h3
-rw-r--r--include/poweroff.h21
2 files changed, 21 insertions, 3 deletions
diff --git a/include/common.h b/include/common.h
index 680a0affb6..dd7445e9b6 100644
--- a/include/common.h
+++ b/include/common.h
@@ -66,9 +66,6 @@ int readline (const char *prompt, char *buf, int len);
/* common/memsize.c */
long get_ram_size (volatile long *, long);
-/* $(CPU)/cpu.c */
-void __noreturn poweroff(void);
-
/* common/console.c */
int ctrlc (void);
diff --git a/include/poweroff.h b/include/poweroff.h
new file mode 100644
index 0000000000..ae9557db5d
--- /dev/null
+++ b/include/poweroff.h
@@ -0,0 +1,21 @@
+#ifndef __INCLUDE_POWEROFF_H
+#define __INCLUDE_POWEROFF_H
+
+void __noreturn poweroff_machine(void);
+
+struct poweroff_handler {
+ void (*poweroff)(struct poweroff_handler *);
+ int priority;
+ const char *name;
+ struct list_head list;
+};
+
+int poweroff_handler_register(struct poweroff_handler *);
+int poweroff_handler_register_fn(void (*poweroff_fn)(struct poweroff_handler *));
+
+#define POWEROFF_DEFAULT_PRIORITY 100
+#define POWEROFF_DEFAULT_NAME "default"
+
+unsigned int of_get_poweroff_priority(struct device_node *node);
+
+#endif /* __INCLUDE_POWEROFF_H */