diff options
Diffstat (limited to 'kernel/irq')
-rw-r--r-- | kernel/irq/chip.c | 43 | ||||
-rw-r--r-- | kernel/irq/handle.c | 3 | ||||
-rw-r--r-- | kernel/irq/manage.c | 38 | ||||
-rw-r--r-- | kernel/irq/proc.c | 1 | ||||
-rw-r--r-- | kernel/irq/spurious.c | 18 |
5 files changed, 48 insertions, 55 deletions
diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c index d96d6f687c48..4895fde4eb93 100644 --- a/kernel/irq/chip.c +++ b/kernel/irq/chip.c | |||
@@ -24,11 +24,9 @@ | |||
24 | */ | 24 | */ |
25 | void dynamic_irq_init(unsigned int irq) | 25 | void dynamic_irq_init(unsigned int irq) |
26 | { | 26 | { |
27 | struct irq_desc *desc; | 27 | struct irq_desc *desc = irq_to_desc(irq); |
28 | unsigned long flags; | 28 | unsigned long flags; |
29 | 29 | ||
30 | /* first time to use this irq_desc */ | ||
31 | desc = irq_to_desc(irq); | ||
32 | if (!desc) { | 30 | if (!desc) { |
33 | WARN(1, KERN_ERR "Trying to initialize invalid IRQ%d\n", irq); | 31 | WARN(1, KERN_ERR "Trying to initialize invalid IRQ%d\n", irq); |
34 | return; | 32 | return; |
@@ -58,10 +56,9 @@ void dynamic_irq_init(unsigned int irq) | |||
58 | */ | 56 | */ |
59 | void dynamic_irq_cleanup(unsigned int irq) | 57 | void dynamic_irq_cleanup(unsigned int irq) |
60 | { | 58 | { |
61 | struct irq_desc *desc; | 59 | struct irq_desc *desc = irq_to_desc(irq); |
62 | unsigned long flags; | 60 | unsigned long flags; |
63 | 61 | ||
64 | desc = irq_to_desc(irq); | ||
65 | if (!desc) { | 62 | if (!desc) { |
66 | WARN(1, KERN_ERR "Trying to cleanup invalid IRQ%d\n", irq); | 63 | WARN(1, KERN_ERR "Trying to cleanup invalid IRQ%d\n", irq); |
67 | return; | 64 | return; |
@@ -90,10 +87,9 @@ void dynamic_irq_cleanup(unsigned int irq) | |||
90 | */ | 87 | */ |
91 | int set_irq_chip(unsigned int irq, struct irq_chip *chip) | 88 | int set_irq_chip(unsigned int irq, struct irq_chip *chip) |
92 | { | 89 | { |
93 | struct irq_desc *desc; | 90 | struct irq_desc *desc = irq_to_desc(irq); |
94 | unsigned long flags; | 91 | unsigned long flags; |
95 | 92 | ||
96 | desc = irq_to_desc(irq); | ||
97 | if (!desc) { | 93 | if (!desc) { |
98 | WARN(1, KERN_ERR "Trying to install chip for IRQ%d\n", irq); | 94 | WARN(1, KERN_ERR "Trying to install chip for IRQ%d\n", irq); |
99 | return -EINVAL; | 95 | return -EINVAL; |
@@ -118,11 +114,10 @@ EXPORT_SYMBOL(set_irq_chip); | |||
118 | */ | 114 | */ |
119 | int set_irq_type(unsigned int irq, unsigned int type) | 115 | int set_irq_type(unsigned int irq, unsigned int type) |
120 | { | 116 | { |
121 | struct irq_desc *desc; | 117 | struct irq_desc *desc = irq_to_desc(irq); |
122 | unsigned long flags; | 118 | unsigned long flags; |
123 | int ret = -ENXIO; | 119 | int ret = -ENXIO; |
124 | 120 | ||
125 | desc = irq_to_desc(irq); | ||
126 | if (!desc) { | 121 | if (!desc) { |
127 | printk(KERN_ERR "Trying to set irq type for IRQ%d\n", irq); | 122 | printk(KERN_ERR "Trying to set irq type for IRQ%d\n", irq); |
128 | return -ENODEV; | 123 | return -ENODEV; |
@@ -147,10 +142,9 @@ EXPORT_SYMBOL(set_irq_type); | |||
147 | */ | 142 | */ |
148 | int set_irq_data(unsigned int irq, void *data) | 143 | int set_irq_data(unsigned int irq, void *data) |
149 | { | 144 | { |
150 | struct irq_desc *desc; | 145 | struct irq_desc *desc = irq_to_desc(irq); |
151 | unsigned long flags; | 146 | unsigned long flags; |
152 | 147 | ||
153 | desc = irq_to_desc(irq); | ||
154 | if (!desc) { | 148 | if (!desc) { |
155 | printk(KERN_ERR | 149 | printk(KERN_ERR |
156 | "Trying to install controller data for IRQ%d\n", irq); | 150 | "Trying to install controller data for IRQ%d\n", irq); |
@@ -173,10 +167,9 @@ EXPORT_SYMBOL(set_irq_data); | |||
173 | */ | 167 | */ |
174 | int set_irq_msi(unsigned int irq, struct msi_desc *entry) | 168 | int set_irq_msi(unsigned int irq, struct msi_desc *entry) |
175 | { | 169 | { |
176 | struct irq_desc *desc; | 170 | struct irq_desc *desc = irq_to_desc(irq); |
177 | unsigned long flags; | 171 | unsigned long flags; |
178 | 172 | ||
179 | desc = irq_to_desc(irq); | ||
180 | if (!desc) { | 173 | if (!desc) { |
181 | printk(KERN_ERR | 174 | printk(KERN_ERR |
182 | "Trying to install msi data for IRQ%d\n", irq); | 175 | "Trying to install msi data for IRQ%d\n", irq); |
@@ -200,10 +193,9 @@ int set_irq_msi(unsigned int irq, struct msi_desc *entry) | |||
200 | */ | 193 | */ |
201 | int set_irq_chip_data(unsigned int irq, void *data) | 194 | int set_irq_chip_data(unsigned int irq, void *data) |
202 | { | 195 | { |
203 | struct irq_desc *desc; | 196 | struct irq_desc *desc = irq_to_desc(irq); |
204 | unsigned long flags; | 197 | unsigned long flags; |
205 | 198 | ||
206 | desc = irq_to_desc(irq); | ||
207 | if (!desc) { | 199 | if (!desc) { |
208 | printk(KERN_ERR | 200 | printk(KERN_ERR |
209 | "Trying to install chip data for IRQ%d\n", irq); | 201 | "Trying to install chip data for IRQ%d\n", irq); |
@@ -228,9 +220,8 @@ EXPORT_SYMBOL(set_irq_chip_data); | |||
228 | */ | 220 | */ |
229 | static void default_enable(unsigned int irq) | 221 | static void default_enable(unsigned int irq) |
230 | { | 222 | { |
231 | struct irq_desc *desc; | 223 | struct irq_desc *desc = irq_to_desc(irq); |
232 | 224 | ||
233 | desc = irq_to_desc(irq); | ||
234 | desc->chip->unmask(irq); | 225 | desc->chip->unmask(irq); |
235 | desc->status &= ~IRQ_MASKED; | 226 | desc->status &= ~IRQ_MASKED; |
236 | } | 227 | } |
@@ -247,11 +238,9 @@ static void default_disable(unsigned int irq) | |||
247 | */ | 238 | */ |
248 | static unsigned int default_startup(unsigned int irq) | 239 | static unsigned int default_startup(unsigned int irq) |
249 | { | 240 | { |
250 | struct irq_desc *desc; | 241 | struct irq_desc *desc = irq_to_desc(irq); |
251 | 242 | ||
252 | desc = irq_to_desc(irq); | ||
253 | desc->chip->enable(irq); | 243 | desc->chip->enable(irq); |
254 | |||
255 | return 0; | 244 | return 0; |
256 | } | 245 | } |
257 | 246 | ||
@@ -260,9 +249,8 @@ static unsigned int default_startup(unsigned int irq) | |||
260 | */ | 249 | */ |
261 | static void default_shutdown(unsigned int irq) | 250 | static void default_shutdown(unsigned int irq) |
262 | { | 251 | { |
263 | struct irq_desc *desc; | 252 | struct irq_desc *desc = irq_to_desc(irq); |
264 | 253 | ||
265 | desc = irq_to_desc(irq); | ||
266 | desc->chip->mask(irq); | 254 | desc->chip->mask(irq); |
267 | desc->status |= IRQ_MASKED; | 255 | desc->status |= IRQ_MASKED; |
268 | } | 256 | } |
@@ -550,10 +538,9 @@ void | |||
550 | __set_irq_handler(unsigned int irq, irq_flow_handler_t handle, int is_chained, | 538 | __set_irq_handler(unsigned int irq, irq_flow_handler_t handle, int is_chained, |
551 | const char *name) | 539 | const char *name) |
552 | { | 540 | { |
553 | struct irq_desc *desc; | 541 | struct irq_desc *desc = irq_to_desc(irq); |
554 | unsigned long flags; | 542 | unsigned long flags; |
555 | 543 | ||
556 | desc = irq_to_desc(irq); | ||
557 | if (!desc) { | 544 | if (!desc) { |
558 | printk(KERN_ERR | 545 | printk(KERN_ERR |
559 | "Trying to install type control for IRQ%d\n", irq); | 546 | "Trying to install type control for IRQ%d\n", irq); |
@@ -614,13 +601,11 @@ set_irq_chip_and_handler_name(unsigned int irq, struct irq_chip *chip, | |||
614 | 601 | ||
615 | void __init set_irq_noprobe(unsigned int irq) | 602 | void __init set_irq_noprobe(unsigned int irq) |
616 | { | 603 | { |
617 | struct irq_desc *desc; | 604 | struct irq_desc *desc = irq_to_desc(irq); |
618 | unsigned long flags; | 605 | unsigned long flags; |
619 | 606 | ||
620 | desc = irq_to_desc(irq); | ||
621 | if (!desc) { | 607 | if (!desc) { |
622 | printk(KERN_ERR "Trying to mark IRQ%d non-probeable\n", irq); | 608 | printk(KERN_ERR "Trying to mark IRQ%d non-probeable\n", irq); |
623 | |||
624 | return; | 609 | return; |
625 | } | 610 | } |
626 | 611 | ||
@@ -631,13 +616,11 @@ void __init set_irq_noprobe(unsigned int irq) | |||
631 | 616 | ||
632 | void __init set_irq_probe(unsigned int irq) | 617 | void __init set_irq_probe(unsigned int irq) |
633 | { | 618 | { |
634 | struct irq_desc *desc; | 619 | struct irq_desc *desc = irq_to_desc(irq); |
635 | unsigned long flags; | 620 | unsigned long flags; |
636 | 621 | ||
637 | desc = irq_to_desc(irq); | ||
638 | if (!desc) { | 622 | if (!desc) { |
639 | printk(KERN_ERR "Trying to mark IRQ%d probeable\n", irq); | 623 | printk(KERN_ERR "Trying to mark IRQ%d probeable\n", irq); |
640 | |||
641 | return; | 624 | return; |
642 | } | 625 | } |
643 | 626 | ||
diff --git a/kernel/irq/handle.c b/kernel/irq/handle.c index 9fe86b3a60a5..a69368ff607f 100644 --- a/kernel/irq/handle.c +++ b/kernel/irq/handle.c | |||
@@ -68,9 +68,8 @@ struct irq_desc irq_desc[NR_IRQS] __cacheline_aligned_in_smp = { | |||
68 | */ | 68 | */ |
69 | static void ack_bad(unsigned int irq) | 69 | static void ack_bad(unsigned int irq) |
70 | { | 70 | { |
71 | struct irq_desc *desc; | 71 | struct irq_desc *desc = irq_to_desc(irq); |
72 | 72 | ||
73 | desc = irq_to_desc(irq); | ||
74 | print_irq_desc(irq, desc); | 73 | print_irq_desc(irq, desc); |
75 | ack_bad_irq(irq); | 74 | ack_bad_irq(irq); |
76 | } | 75 | } |
diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c index ad2ce72c83c4..c498a1b8c621 100644 --- a/kernel/irq/manage.c +++ b/kernel/irq/manage.c | |||
@@ -140,10 +140,9 @@ int irq_select_affinity(unsigned int irq) | |||
140 | */ | 140 | */ |
141 | void disable_irq_nosync(unsigned int irq) | 141 | void disable_irq_nosync(unsigned int irq) |
142 | { | 142 | { |
143 | struct irq_desc *desc; | 143 | struct irq_desc *desc = irq_to_desc(irq); |
144 | unsigned long flags; | 144 | unsigned long flags; |
145 | 145 | ||
146 | desc = irq_to_desc(irq); | ||
147 | if (!desc) | 146 | if (!desc) |
148 | return; | 147 | return; |
149 | 148 | ||
@@ -170,9 +169,8 @@ EXPORT_SYMBOL(disable_irq_nosync); | |||
170 | */ | 169 | */ |
171 | void disable_irq(unsigned int irq) | 170 | void disable_irq(unsigned int irq) |
172 | { | 171 | { |
173 | struct irq_desc *desc; | 172 | struct irq_desc *desc = irq_to_desc(irq); |
174 | 173 | ||
175 | desc = irq_to_desc(irq); | ||
176 | if (!desc) | 174 | if (!desc) |
177 | return; | 175 | return; |
178 | 176 | ||
@@ -213,10 +211,9 @@ static void __enable_irq(struct irq_desc *desc, unsigned int irq) | |||
213 | */ | 211 | */ |
214 | void enable_irq(unsigned int irq) | 212 | void enable_irq(unsigned int irq) |
215 | { | 213 | { |
216 | struct irq_desc *desc; | 214 | struct irq_desc *desc = irq_to_desc(irq); |
217 | unsigned long flags; | 215 | unsigned long flags; |
218 | 216 | ||
219 | desc = irq_to_desc(irq); | ||
220 | if (!desc) | 217 | if (!desc) |
221 | return; | 218 | return; |
222 | 219 | ||
@@ -291,10 +288,9 @@ EXPORT_SYMBOL(set_irq_wake); | |||
291 | */ | 288 | */ |
292 | int can_request_irq(unsigned int irq, unsigned long irqflags) | 289 | int can_request_irq(unsigned int irq, unsigned long irqflags) |
293 | { | 290 | { |
294 | struct irq_desc *desc; | 291 | struct irq_desc *desc = irq_to_desc(irq); |
295 | struct irqaction *action; | 292 | struct irqaction *action; |
296 | 293 | ||
297 | desc = irq_to_desc(irq); | ||
298 | if (!desc) | 294 | if (!desc) |
299 | return 0; | 295 | return 0; |
300 | 296 | ||
@@ -355,16 +351,15 @@ int __irq_set_trigger(struct irq_desc *desc, unsigned int irq, | |||
355 | * Internal function to register an irqaction - typically used to | 351 | * Internal function to register an irqaction - typically used to |
356 | * allocate special interrupts that are part of the architecture. | 352 | * allocate special interrupts that are part of the architecture. |
357 | */ | 353 | */ |
358 | int setup_irq(unsigned int irq, struct irqaction *new) | 354 | static int |
355 | __setup_irq(unsigned int irq, struct irq_desc * desc, struct irqaction *new) | ||
359 | { | 356 | { |
360 | struct irq_desc *desc; | ||
361 | struct irqaction *old, **p; | 357 | struct irqaction *old, **p; |
362 | const char *old_name = NULL; | 358 | const char *old_name = NULL; |
363 | unsigned long flags; | 359 | unsigned long flags; |
364 | int shared = 0; | 360 | int shared = 0; |
365 | int ret; | 361 | int ret; |
366 | 362 | ||
367 | desc = irq_to_desc(irq); | ||
368 | if (!desc) | 363 | if (!desc) |
369 | return -EINVAL; | 364 | return -EINVAL; |
370 | 365 | ||
@@ -504,6 +499,20 @@ mismatch: | |||
504 | } | 499 | } |
505 | 500 | ||
506 | /** | 501 | /** |
502 | * setup_irq - setup an interrupt | ||
503 | * @irq: Interrupt line to setup | ||
504 | * @act: irqaction for the interrupt | ||
505 | * | ||
506 | * Used to statically setup interrupts in the early boot process. | ||
507 | */ | ||
508 | int setup_irq(unsigned int irq, struct irqaction *act) | ||
509 | { | ||
510 | struct irq_desc *desc = irq_to_desc(irq); | ||
511 | |||
512 | return __setup_irq(irq, desc, act); | ||
513 | } | ||
514 | |||
515 | /** | ||
507 | * free_irq - free an interrupt | 516 | * free_irq - free an interrupt |
508 | * @irq: Interrupt line to free | 517 | * @irq: Interrupt line to free |
509 | * @dev_id: Device identity to free | 518 | * @dev_id: Device identity to free |
@@ -519,13 +528,12 @@ mismatch: | |||
519 | */ | 528 | */ |
520 | void free_irq(unsigned int irq, void *dev_id) | 529 | void free_irq(unsigned int irq, void *dev_id) |
521 | { | 530 | { |
522 | struct irq_desc *desc; | 531 | struct irq_desc *desc = irq_to_desc(irq); |
523 | struct irqaction **p; | 532 | struct irqaction **p; |
524 | unsigned long flags; | 533 | unsigned long flags; |
525 | 534 | ||
526 | WARN_ON(in_interrupt()); | 535 | WARN_ON(in_interrupt()); |
527 | 536 | ||
528 | desc = irq_to_desc(irq); | ||
529 | if (!desc) | 537 | if (!desc) |
530 | return; | 538 | return; |
531 | 539 | ||
@@ -624,8 +632,8 @@ int request_irq(unsigned int irq, irq_handler_t handler, | |||
624 | unsigned long irqflags, const char *devname, void *dev_id) | 632 | unsigned long irqflags, const char *devname, void *dev_id) |
625 | { | 633 | { |
626 | struct irqaction *action; | 634 | struct irqaction *action; |
627 | int retval; | ||
628 | struct irq_desc *desc; | 635 | struct irq_desc *desc; |
636 | int retval; | ||
629 | 637 | ||
630 | #ifdef CONFIG_LOCKDEP | 638 | #ifdef CONFIG_LOCKDEP |
631 | /* | 639 | /* |
@@ -662,7 +670,7 @@ int request_irq(unsigned int irq, irq_handler_t handler, | |||
662 | action->next = NULL; | 670 | action->next = NULL; |
663 | action->dev_id = dev_id; | 671 | action->dev_id = dev_id; |
664 | 672 | ||
665 | retval = setup_irq(irq, action); | 673 | retval = __setup_irq(irq, desc, action); |
666 | if (retval) | 674 | if (retval) |
667 | kfree(action); | 675 | kfree(action); |
668 | 676 | ||
diff --git a/kernel/irq/proc.c b/kernel/irq/proc.c index bc0993d86c8b..fac014a81b24 100644 --- a/kernel/irq/proc.c +++ b/kernel/irq/proc.c | |||
@@ -215,6 +215,7 @@ void unregister_handler_proc(unsigned int irq, struct irqaction *action) | |||
215 | { | 215 | { |
216 | if (action->dir) { | 216 | if (action->dir) { |
217 | struct irq_desc *desc = irq_to_desc(irq); | 217 | struct irq_desc *desc = irq_to_desc(irq); |
218 | |||
218 | remove_proc_entry(action->dir->name, desc->dir); | 219 | remove_proc_entry(action->dir->name, desc->dir); |
219 | } | 220 | } |
220 | } | 221 | } |
diff --git a/kernel/irq/spurious.c b/kernel/irq/spurious.c index ec5a4bef3054..dd364c11e56e 100644 --- a/kernel/irq/spurious.c +++ b/kernel/irq/spurious.c | |||
@@ -26,8 +26,7 @@ static DEFINE_TIMER(poll_spurious_irq_timer, poll_spurious_irqs, 0, 0); | |||
26 | static int try_one_irq(int irq, struct irq_desc *desc) | 26 | static int try_one_irq(int irq, struct irq_desc *desc) |
27 | { | 27 | { |
28 | struct irqaction *action; | 28 | struct irqaction *action; |
29 | int ok = 0; | 29 | int ok = 0, work = 0; |
30 | int work = 0; /* Did we do work for a real IRQ */ | ||
31 | 30 | ||
32 | spin_lock(&desc->lock); | 31 | spin_lock(&desc->lock); |
33 | /* Already running on another processor */ | 32 | /* Already running on another processor */ |
@@ -88,9 +87,8 @@ static int try_one_irq(int irq, struct irq_desc *desc) | |||
88 | 87 | ||
89 | static int misrouted_irq(int irq) | 88 | static int misrouted_irq(int irq) |
90 | { | 89 | { |
91 | int i; | ||
92 | int ok = 0; | ||
93 | struct irq_desc *desc; | 90 | struct irq_desc *desc; |
91 | int i, ok = 0; | ||
94 | 92 | ||
95 | for_each_irq_desc(i, desc) { | 93 | for_each_irq_desc(i, desc) { |
96 | if (!i) | 94 | if (!i) |
@@ -108,8 +106,8 @@ static int misrouted_irq(int irq) | |||
108 | 106 | ||
109 | static void poll_spurious_irqs(unsigned long dummy) | 107 | static void poll_spurious_irqs(unsigned long dummy) |
110 | { | 108 | { |
111 | int i; | ||
112 | struct irq_desc *desc; | 109 | struct irq_desc *desc; |
110 | int i; | ||
113 | 111 | ||
114 | for_each_irq_desc(i, desc) { | 112 | for_each_irq_desc(i, desc) { |
115 | unsigned int status; | 113 | unsigned int status; |
@@ -126,7 +124,8 @@ static void poll_spurious_irqs(unsigned long dummy) | |||
126 | try_one_irq(i, desc); | 124 | try_one_irq(i, desc); |
127 | } | 125 | } |
128 | 126 | ||
129 | mod_timer(&poll_spurious_irq_timer, jiffies + POLL_SPURIOUS_IRQ_INTERVAL); | 127 | mod_timer(&poll_spurious_irq_timer, |
128 | jiffies + POLL_SPURIOUS_IRQ_INTERVAL); | ||
130 | } | 129 | } |
131 | 130 | ||
132 | /* | 131 | /* |
@@ -177,7 +176,9 @@ report_bad_irq(unsigned int irq, struct irq_desc *desc, irqreturn_t action_ret) | |||
177 | } | 176 | } |
178 | } | 177 | } |
179 | 178 | ||
180 | static inline int try_misrouted_irq(unsigned int irq, struct irq_desc *desc, irqreturn_t action_ret) | 179 | static inline int |
180 | try_misrouted_irq(unsigned int irq, struct irq_desc *desc, | ||
181 | irqreturn_t action_ret) | ||
181 | { | 182 | { |
182 | struct irqaction *action; | 183 | struct irqaction *action; |
183 | 184 | ||
@@ -253,7 +254,8 @@ void note_interrupt(unsigned int irq, struct irq_desc *desc, | |||
253 | desc->depth++; | 254 | desc->depth++; |
254 | desc->chip->disable(irq); | 255 | desc->chip->disable(irq); |
255 | 256 | ||
256 | mod_timer(&poll_spurious_irq_timer, jiffies + POLL_SPURIOUS_IRQ_INTERVAL); | 257 | mod_timer(&poll_spurious_irq_timer, |
258 | jiffies + POLL_SPURIOUS_IRQ_INTERVAL); | ||
257 | } | 259 | } |
258 | desc->irqs_unhandled = 0; | 260 | desc->irqs_unhandled = 0; |
259 | } | 261 | } |