xref: /linux/arch/arm/include/asm/thread_notify.h (revision 75bf465f0bc33e9b776a46d6a1b9b990f5fb7c37)
1*d2912cb1SThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-only */
24baa9922SRussell King /*
34baa9922SRussell King  *  arch/arm/include/asm/thread_notify.h
44baa9922SRussell King  *
54baa9922SRussell King  *  Copyright (C) 2006 Russell King.
64baa9922SRussell King  */
74baa9922SRussell King #ifndef ASMARM_THREAD_NOTIFY_H
84baa9922SRussell King #define ASMARM_THREAD_NOTIFY_H
94baa9922SRussell King 
104baa9922SRussell King #ifdef __KERNEL__
114baa9922SRussell King 
124baa9922SRussell King #ifndef __ASSEMBLY__
134baa9922SRussell King 
144baa9922SRussell King #include <linux/notifier.h>
154baa9922SRussell King #include <asm/thread_info.h>
164baa9922SRussell King 
thread_register_notifier(struct notifier_block * n)174baa9922SRussell King static inline int thread_register_notifier(struct notifier_block *n)
184baa9922SRussell King {
194baa9922SRussell King 	extern struct atomic_notifier_head thread_notify_head;
204baa9922SRussell King 	return atomic_notifier_chain_register(&thread_notify_head, n);
214baa9922SRussell King }
224baa9922SRussell King 
thread_unregister_notifier(struct notifier_block * n)234baa9922SRussell King static inline void thread_unregister_notifier(struct notifier_block *n)
244baa9922SRussell King {
254baa9922SRussell King 	extern struct atomic_notifier_head thread_notify_head;
264baa9922SRussell King 	atomic_notifier_chain_unregister(&thread_notify_head, n);
274baa9922SRussell King }
284baa9922SRussell King 
thread_notify(unsigned long rc,struct thread_info * thread)294baa9922SRussell King static inline void thread_notify(unsigned long rc, struct thread_info *thread)
304baa9922SRussell King {
314baa9922SRussell King 	extern struct atomic_notifier_head thread_notify_head;
324baa9922SRussell King 	atomic_notifier_call_chain(&thread_notify_head, rc, thread);
334baa9922SRussell King }
344baa9922SRussell King 
354baa9922SRussell King #endif
364baa9922SRussell King 
374baa9922SRussell King /*
384baa9922SRussell King  * These are the reason codes for the thread notifier.
394baa9922SRussell King  */
404baa9922SRussell King #define THREAD_NOTIFY_FLUSH	0
41797245f5SRussell King #define THREAD_NOTIFY_EXIT	1
424baa9922SRussell King #define THREAD_NOTIFY_SWITCH	2
432e82669aSCatalin Marinas #define THREAD_NOTIFY_COPY	3
444baa9922SRussell King 
454baa9922SRussell King #endif
464baa9922SRussell King #endif
47