aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/irq/manage.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/irq/manage.c')
-rw-r--r--kernel/irq/manage.c35
1 files changed, 20 insertions, 15 deletions
diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
index d5a4333d8f1f..b5943e9f95aa 100644
--- a/kernel/irq/manage.c
+++ b/kernel/irq/manage.c
@@ -31,7 +31,7 @@ cpumask_t irq_default_affinity = CPU_MASK_ALL;
31 */ 31 */
32void synchronize_irq(unsigned int irq) 32void synchronize_irq(unsigned int irq)
33{ 33{
34 struct irq_desc *desc = irq_desc + irq; 34 struct irq_desc *desc = irq_to_desc(irq);
35 unsigned int status; 35 unsigned int status;
36 36
37 if (irq >= nr_irqs) 37 if (irq >= nr_irqs)
@@ -64,7 +64,7 @@ EXPORT_SYMBOL(synchronize_irq);
64 */ 64 */
65int irq_can_set_affinity(unsigned int irq) 65int irq_can_set_affinity(unsigned int irq)
66{ 66{
67 struct irq_desc *desc = irq_desc + irq; 67 struct irq_desc *desc = irq_to_desc(irq);
68 68
69 if (CHECK_IRQ_PER_CPU(desc->status) || !desc->chip || 69 if (CHECK_IRQ_PER_CPU(desc->status) || !desc->chip ||
70 !desc->chip->set_affinity) 70 !desc->chip->set_affinity)
@@ -81,7 +81,7 @@ int irq_can_set_affinity(unsigned int irq)
81 */ 81 */
82int irq_set_affinity(unsigned int irq, cpumask_t cpumask) 82int irq_set_affinity(unsigned int irq, cpumask_t cpumask)
83{ 83{
84 struct irq_desc *desc = irq_desc + irq; 84 struct irq_desc *desc = irq_to_desc(irq);
85 85
86 if (!desc->chip->set_affinity) 86 if (!desc->chip->set_affinity)
87 return -EINVAL; 87 return -EINVAL;
@@ -111,14 +111,16 @@ int irq_set_affinity(unsigned int irq, cpumask_t cpumask)
111int irq_select_affinity(unsigned int irq) 111int irq_select_affinity(unsigned int irq)
112{ 112{
113 cpumask_t mask; 113 cpumask_t mask;
114 struct irq_desc *desc;
114 115
115 if (!irq_can_set_affinity(irq)) 116 if (!irq_can_set_affinity(irq))
116 return 0; 117 return 0;
117 118
118 cpus_and(mask, cpu_online_map, irq_default_affinity); 119 cpus_and(mask, cpu_online_map, irq_default_affinity);
119 120
120 irq_desc[irq].affinity = mask; 121 desc = irq_to_desc(irq);
121 irq_desc[irq].chip->set_affinity(irq, mask); 122 desc->affinity = mask;
123 desc->chip->set_affinity(irq, mask);
122 124
123 set_balance_irq_affinity(irq, mask); 125 set_balance_irq_affinity(irq, mask);
124 return 0; 126 return 0;
@@ -140,7 +142,7 @@ int irq_select_affinity(unsigned int irq)
140 */ 142 */
141void disable_irq_nosync(unsigned int irq) 143void disable_irq_nosync(unsigned int irq)
142{ 144{
143 struct irq_desc *desc = irq_desc + irq; 145 struct irq_desc *desc = irq_to_desc(irq);
144 unsigned long flags; 146 unsigned long flags;
145 147
146 if (irq >= nr_irqs) 148 if (irq >= nr_irqs)
@@ -169,7 +171,7 @@ EXPORT_SYMBOL(disable_irq_nosync);
169 */ 171 */
170void disable_irq(unsigned int irq) 172void disable_irq(unsigned int irq)
171{ 173{
172 struct irq_desc *desc = irq_desc + irq; 174 struct irq_desc *desc = irq_to_desc(irq);
173 175
174 if (irq >= nr_irqs) 176 if (irq >= nr_irqs)
175 return; 177 return;
@@ -211,7 +213,7 @@ static void __enable_irq(struct irq_desc *desc, unsigned int irq)
211 */ 213 */
212void enable_irq(unsigned int irq) 214void enable_irq(unsigned int irq)
213{ 215{
214 struct irq_desc *desc = irq_desc + irq; 216 struct irq_desc *desc = irq_to_desc(irq);
215 unsigned long flags; 217 unsigned long flags;
216 218
217 if (irq >= nr_irqs) 219 if (irq >= nr_irqs)
@@ -225,7 +227,7 @@ EXPORT_SYMBOL(enable_irq);
225 227
226static int set_irq_wake_real(unsigned int irq, unsigned int on) 228static int set_irq_wake_real(unsigned int irq, unsigned int on)
227{ 229{
228 struct irq_desc *desc = irq_desc + irq; 230 struct irq_desc *desc = irq_to_desc(irq);
229 int ret = -ENXIO; 231 int ret = -ENXIO;
230 232
231 if (desc->chip->set_wake) 233 if (desc->chip->set_wake)
@@ -248,7 +250,7 @@ static int set_irq_wake_real(unsigned int irq, unsigned int on)
248 */ 250 */
249int set_irq_wake(unsigned int irq, unsigned int on) 251int set_irq_wake(unsigned int irq, unsigned int on)
250{ 252{
251 struct irq_desc *desc = irq_desc + irq; 253 struct irq_desc *desc = irq_to_desc(irq);
252 unsigned long flags; 254 unsigned long flags;
253 int ret = 0; 255 int ret = 0;
254 256
@@ -288,12 +290,13 @@ EXPORT_SYMBOL(set_irq_wake);
288 */ 290 */
289int can_request_irq(unsigned int irq, unsigned long irqflags) 291int can_request_irq(unsigned int irq, unsigned long irqflags)
290{ 292{
293 struct irq_desc *desc = irq_to_desc(irq);
291 struct irqaction *action; 294 struct irqaction *action;
292 295
293 if (irq >= nr_irqs || irq_desc[irq].status & IRQ_NOREQUEST) 296 if (irq >= nr_irqs || desc->status & IRQ_NOREQUEST)
294 return 0; 297 return 0;
295 298
296 action = irq_desc[irq].action; 299 action = desc->action;
297 if (action) 300 if (action)
298 if (irqflags & action->flags & IRQF_SHARED) 301 if (irqflags & action->flags & IRQF_SHARED)
299 action = NULL; 302 action = NULL;
@@ -349,7 +352,7 @@ int __irq_set_trigger(struct irq_desc *desc, unsigned int irq,
349 */ 352 */
350int setup_irq(unsigned int irq, struct irqaction *new) 353int setup_irq(unsigned int irq, struct irqaction *new)
351{ 354{
352 struct irq_desc *desc = irq_desc + irq; 355 struct irq_desc *desc = irq_to_desc(irq);
353 struct irqaction *old, **p; 356 struct irqaction *old, **p;
354 const char *old_name = NULL; 357 const char *old_name = NULL;
355 unsigned long flags; 358 unsigned long flags;
@@ -518,7 +521,7 @@ void free_irq(unsigned int irq, void *dev_id)
518 if (irq >= nr_irqs) 521 if (irq >= nr_irqs)
519 return; 522 return;
520 523
521 desc = irq_desc + irq; 524 desc = irq_to_desc(irq);
522 spin_lock_irqsave(&desc->lock, flags); 525 spin_lock_irqsave(&desc->lock, flags);
523 p = &desc->action; 526 p = &desc->action;
524 for (;;) { 527 for (;;) {
@@ -615,6 +618,7 @@ int request_irq(unsigned int irq, irq_handler_t handler,
615{ 618{
616 struct irqaction *action; 619 struct irqaction *action;
617 int retval; 620 int retval;
621 struct irq_desc *desc;
618 622
619#ifdef CONFIG_LOCKDEP 623#ifdef CONFIG_LOCKDEP
620 /* 624 /*
@@ -632,7 +636,8 @@ int request_irq(unsigned int irq, irq_handler_t handler,
632 return -EINVAL; 636 return -EINVAL;
633 if (irq >= nr_irqs) 637 if (irq >= nr_irqs)
634 return -EINVAL; 638 return -EINVAL;
635 if (irq_desc[irq].status & IRQ_NOREQUEST) 639 desc = irq_to_desc(irq);
640 if (desc->status & IRQ_NOREQUEST)
636 return -EINVAL; 641 return -EINVAL;
637 if (!handler) 642 if (!handler)
638 return -EINVAL; 643 return -EINVAL;