summaryrefslogtreecommitdiffstats
path: root/include/notifier.h
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2009-05-13 16:00:11 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2009-05-13 16:00:11 +0200
commit06a20b38f884a0de11781c2da07e794bf3f08ee6 (patch)
treea4952d1dec5037a8cdaeca8fd1061f8f0eb3f63c /include/notifier.h
parent1ecc871b3a99416e051485e134c2a6787d15f02b (diff)
downloadbarebox-06a20b38f884a0de11781c2da07e794bf3f08ee6.tar.gz
barebox-06a20b38f884a0de11781c2da07e794bf3f08ee6.tar.xz
Add notifier framework
This is loosely based on the Linux notifier framework, but stripped down to the bare minimum. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'include/notifier.h')
-rw-r--r--include/notifier.h35
1 files changed, 35 insertions, 0 deletions
diff --git a/include/notifier.h b/include/notifier.h
new file mode 100644
index 0000000000..878b17e078
--- /dev/null
+++ b/include/notifier.h
@@ -0,0 +1,35 @@
+#ifndef __NOTIFIER_H
+#define __NOTIFIER_H
+
+/*
+ * Notifer chains loosely based on the according Linux framework
+ */
+
+struct notifier_block {
+ int (*notifier_call)(struct notifier_block *, unsigned long, void *);
+ struct list_head list;
+};
+
+struct notifier_head {
+ struct list_head blocks;
+};
+
+int notifier_chain_register(struct notifier_head *nh, struct notifier_block *n);
+
+int notifier_call_chain(struct notifier_head *nh, unsigned long val, void *v);
+
+/*
+ * Register a function which is called upon changes of
+ * clock frequencies in the system.
+ */
+int clock_register_client(struct notifier_block *nb);
+int clock_unregister_client(struct notifier_block *nb);
+int clock_notifier_call_chain(void);
+
+#define NOTIFIER_HEAD(name) \
+ struct notifier_head name = { \
+ .blocks = LIST_HEAD_INIT((name).blocks), \
+ };
+
+#endif /* __NOTIFIER_H */
+