This client driver allows you to use a GPIO pin as a source for PPS
[linux-2.6/next.git] / kernel / rcu.h
blobf600868d550dc1764f7541f3cf87c14589f007f7
1 /*
2 * Read-Copy Update definitions shared among RCU implementations.
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 * Copyright IBM Corporation, 2011
20 * Author: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
23 #ifndef __LINUX_RCU_H
24 #define __LINUX_RCU_H
26 #ifdef CONFIG_RCU_TRACE
27 #define RCU_TRACE(stmt) stmt
28 #else /* #ifdef CONFIG_RCU_TRACE */
29 #define RCU_TRACE(stmt)
30 #endif /* #else #ifdef CONFIG_RCU_TRACE */
33 * debug_rcu_head_queue()/debug_rcu_head_unqueue() are used internally
34 * by call_rcu() and rcu callback execution, and are therefore not part of the
35 * RCU API. Leaving in rcupdate.h because they are used by all RCU flavors.
38 #ifdef CONFIG_DEBUG_OBJECTS_RCU_HEAD
39 # define STATE_RCU_HEAD_READY 0
40 # define STATE_RCU_HEAD_QUEUED 1
42 extern struct debug_obj_descr rcuhead_debug_descr;
44 static inline void debug_rcu_head_queue(struct rcu_head *head)
46 WARN_ON_ONCE((unsigned long)head & 0x3);
47 debug_object_activate(head, &rcuhead_debug_descr);
48 debug_object_active_state(head, &rcuhead_debug_descr,
49 STATE_RCU_HEAD_READY,
50 STATE_RCU_HEAD_QUEUED);
53 static inline void debug_rcu_head_unqueue(struct rcu_head *head)
55 debug_object_active_state(head, &rcuhead_debug_descr,
56 STATE_RCU_HEAD_QUEUED,
57 STATE_RCU_HEAD_READY);
58 debug_object_deactivate(head, &rcuhead_debug_descr);
60 #else /* !CONFIG_DEBUG_OBJECTS_RCU_HEAD */
61 static inline void debug_rcu_head_queue(struct rcu_head *head)
65 static inline void debug_rcu_head_unqueue(struct rcu_head *head)
68 #endif /* #else !CONFIG_DEBUG_OBJECTS_RCU_HEAD */
70 extern void kfree(const void *);
72 static inline void __rcu_reclaim(char *rn, struct rcu_head *head)
74 unsigned long offset = (unsigned long)head->func;
76 if (__is_kfree_rcu_offset(offset)) {
77 RCU_TRACE(trace_rcu_invoke_kfree_callback(rn, head, offset));
78 kfree((void *)head - offset);
79 } else {
80 RCU_TRACE(trace_rcu_invoke_callback(rn, head));
81 head->func(head);
85 #endif /* __LINUX_RCU_H */