aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/irq
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2010-10-01 10:03:45 -0400
committerThomas Gleixner <tglx@linutronix.de>2010-10-12 10:39:04 -0400
commite144710b302525de5b90b9c3ba43562458d8957f (patch)
tree0a6ef61ccb4957512ebf4a1887ba3bc54e78f99e /kernel/irq
parentfe21221386e46b8e0f2cbd83559a29680c28473b (diff)
genirq: Distangle irq.h
Move irq_desc and internal functions out of irq.h Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/irq')
-rw-r--r--kernel/irq/internals.h100
1 files changed, 100 insertions, 0 deletions
diff --git a/kernel/irq/internals.h b/kernel/irq/internals.h
index b905f0ab1bb2..e281e45fbb55 100644
--- a/kernel/irq/internals.h
+++ b/kernel/irq/internals.h
@@ -1,6 +1,7 @@
1/* 1/*
2 * IRQ subsystem internal functions and variables: 2 * IRQ subsystem internal functions and variables:
3 */ 3 */
4#include <linux/irqdesc.h>
4 5
5extern int noirqdebug; 6extern int noirqdebug;
6 7
@@ -22,6 +23,9 @@ extern void init_kstat_irqs(struct irq_desc *desc, int node, int nr);
22extern void clear_kstat_irqs(struct irq_desc *desc); 23extern void clear_kstat_irqs(struct irq_desc *desc);
23extern raw_spinlock_t sparse_irq_lock; 24extern raw_spinlock_t sparse_irq_lock;
24 25
26/* Resending of interrupts :*/
27void check_irq_resend(struct irq_desc *desc, unsigned int irq);
28
25#ifdef CONFIG_SPARSE_IRQ 29#ifdef CONFIG_SPARSE_IRQ
26void replace_irq_desc(unsigned int irq, struct irq_desc *desc); 30void replace_irq_desc(unsigned int irq, struct irq_desc *desc);
27#endif 31#endif
@@ -105,3 +109,99 @@ static inline void print_irq_desc(unsigned int irq, struct irq_desc *desc)
105 109
106#undef P 110#undef P
107 111
112/* Stuff below will be cleaned up after the sparse allocator is done */
113
114#ifdef CONFIG_SMP
115/**
116 * alloc_desc_masks - allocate cpumasks for irq_desc
117 * @desc: pointer to irq_desc struct
118 * @node: node which will be handling the cpumasks
119 * @boot: true if need bootmem
120 *
121 * Allocates affinity and pending_mask cpumask if required.
122 * Returns true if successful (or not required).
123 */
124static inline bool alloc_desc_masks(struct irq_desc *desc, int node,
125 bool boot)
126{
127 gfp_t gfp = GFP_ATOMIC;
128
129 if (boot)
130 gfp = GFP_NOWAIT;
131
132#ifdef CONFIG_CPUMASK_OFFSTACK
133 if (!alloc_cpumask_var_node(&desc->irq_data.affinity, gfp, node))
134 return false;
135
136#ifdef CONFIG_GENERIC_PENDING_IRQ
137 if (!alloc_cpumask_var_node(&desc->pending_mask, gfp, node)) {
138 free_cpumask_var(desc->irq_data.affinity);
139 return false;
140 }
141#endif
142#endif
143 return true;
144}
145
146static inline void init_desc_masks(struct irq_desc *desc)
147{
148 cpumask_setall(desc->irq_data.affinity);
149#ifdef CONFIG_GENERIC_PENDING_IRQ
150 cpumask_clear(desc->pending_mask);
151#endif
152}
153
154/**
155 * init_copy_desc_masks - copy cpumasks for irq_desc
156 * @old_desc: pointer to old irq_desc struct
157 * @new_desc: pointer to new irq_desc struct
158 *
159 * Insures affinity and pending_masks are copied to new irq_desc.
160 * If !CONFIG_CPUMASKS_OFFSTACK the cpumasks are embedded in the
161 * irq_desc struct so the copy is redundant.
162 */
163
164static inline void init_copy_desc_masks(struct irq_desc *old_desc,
165 struct irq_desc *new_desc)
166{
167#ifdef CONFIG_CPUMASK_OFFSTACK
168 cpumask_copy(new_desc->irq_data.affinity, old_desc->irq_data.affinity);
169
170#ifdef CONFIG_GENERIC_PENDING_IRQ
171 cpumask_copy(new_desc->pending_mask, old_desc->pending_mask);
172#endif
173#endif
174}
175
176static inline void free_desc_masks(struct irq_desc *old_desc,
177 struct irq_desc *new_desc)
178{
179 free_cpumask_var(old_desc->irq_data.affinity);
180
181#ifdef CONFIG_GENERIC_PENDING_IRQ
182 free_cpumask_var(old_desc->pending_mask);
183#endif
184}
185
186#else /* !CONFIG_SMP */
187
188static inline bool alloc_desc_masks(struct irq_desc *desc, int node,
189 bool boot)
190{
191 return true;
192}
193
194static inline void init_desc_masks(struct irq_desc *desc)
195{
196}
197
198static inline void init_copy_desc_masks(struct irq_desc *old_desc,
199 struct irq_desc *new_desc)
200{
201}
202
203static inline void free_desc_masks(struct irq_desc *old_desc,
204 struct irq_desc *new_desc)
205{
206}
207#endif /* CONFIG_SMP */