Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-only */
0002 /*
0003  *  arch/arm/include/asm/thread_notify.h
0004  *
0005  *  Copyright (C) 2006 Russell King.
0006  */
0007 #ifndef ASMARM_THREAD_NOTIFY_H
0008 #define ASMARM_THREAD_NOTIFY_H
0009 
0010 #ifdef __KERNEL__
0011 
0012 #ifndef __ASSEMBLY__
0013 
0014 #include <linux/notifier.h>
0015 #include <asm/thread_info.h>
0016 
0017 static inline int thread_register_notifier(struct notifier_block *n)
0018 {
0019     extern struct atomic_notifier_head thread_notify_head;
0020     return atomic_notifier_chain_register(&thread_notify_head, n);
0021 }
0022 
0023 static inline void thread_unregister_notifier(struct notifier_block *n)
0024 {
0025     extern struct atomic_notifier_head thread_notify_head;
0026     atomic_notifier_chain_unregister(&thread_notify_head, n);
0027 }
0028 
0029 static inline void thread_notify(unsigned long rc, struct thread_info *thread)
0030 {
0031     extern struct atomic_notifier_head thread_notify_head;
0032     atomic_notifier_call_chain(&thread_notify_head, rc, thread);
0033 }
0034 
0035 #endif
0036 
0037 /*
0038  * These are the reason codes for the thread notifier.
0039  */
0040 #define THREAD_NOTIFY_FLUSH 0
0041 #define THREAD_NOTIFY_EXIT  1
0042 #define THREAD_NOTIFY_SWITCH    2
0043 #define THREAD_NOTIFY_COPY  3
0044 
0045 #endif
0046 #endif