xref: /linux/arch/arm/include/asm/thread_notify.h (revision 2e82669acf03e5bf2080f5d3ef005168e67d8a51)
14baa9922SRussell King /*
24baa9922SRussell King  *  arch/arm/include/asm/thread_notify.h
34baa9922SRussell King  *
44baa9922SRussell King  *  Copyright (C) 2006 Russell King.
54baa9922SRussell King  *
64baa9922SRussell King  * This program is free software; you can redistribute it and/or modify
74baa9922SRussell King  * it under the terms of the GNU General Public License version 2 as
84baa9922SRussell King  * published by the Free Software Foundation.
94baa9922SRussell King  */
104baa9922SRussell King #ifndef ASMARM_THREAD_NOTIFY_H
114baa9922SRussell King #define ASMARM_THREAD_NOTIFY_H
124baa9922SRussell King 
134baa9922SRussell King #ifdef __KERNEL__
144baa9922SRussell King 
154baa9922SRussell King #ifndef __ASSEMBLY__
164baa9922SRussell King 
174baa9922SRussell King #include <linux/notifier.h>
184baa9922SRussell King #include <asm/thread_info.h>
194baa9922SRussell King 
204baa9922SRussell King static inline int thread_register_notifier(struct notifier_block *n)
214baa9922SRussell King {
224baa9922SRussell King 	extern struct atomic_notifier_head thread_notify_head;
234baa9922SRussell King 	return atomic_notifier_chain_register(&thread_notify_head, n);
244baa9922SRussell King }
254baa9922SRussell King 
264baa9922SRussell King static inline void thread_unregister_notifier(struct notifier_block *n)
274baa9922SRussell King {
284baa9922SRussell King 	extern struct atomic_notifier_head thread_notify_head;
294baa9922SRussell King 	atomic_notifier_chain_unregister(&thread_notify_head, n);
304baa9922SRussell King }
314baa9922SRussell King 
324baa9922SRussell King static inline void thread_notify(unsigned long rc, struct thread_info *thread)
334baa9922SRussell King {
344baa9922SRussell King 	extern struct atomic_notifier_head thread_notify_head;
354baa9922SRussell King 	atomic_notifier_call_chain(&thread_notify_head, rc, thread);
364baa9922SRussell King }
374baa9922SRussell King 
384baa9922SRussell King #endif
394baa9922SRussell King 
404baa9922SRussell King /*
414baa9922SRussell King  * These are the reason codes for the thread notifier.
424baa9922SRussell King  */
434baa9922SRussell King #define THREAD_NOTIFY_FLUSH	0
44797245f5SRussell King #define THREAD_NOTIFY_EXIT	1
454baa9922SRussell King #define THREAD_NOTIFY_SWITCH	2
46*2e82669aSCatalin Marinas #define THREAD_NOTIFY_COPY	3
474baa9922SRussell King 
484baa9922SRussell King #endif
494baa9922SRussell King #endif
50