aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/irq/chip.c
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2011-02-07 16:11:30 -0500
committerThomas Gleixner <tglx@linutronix.de>2011-02-19 06:58:17 -0500
commitc1594b77e46124bb462f961e536120e471c67446 (patch)
tree3f52ad5809125ab5be6db1fd4b1212fe6127df66 /kernel/irq/chip.c
parent163ef3091195f514a06f064b12914597d2644c55 (diff)
genirq: Move IRQ_DISABLED to core
Keep status in sync until all abusers are fixed. Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'kernel/irq/chip.c')
-rw-r--r--kernel/irq/chip.c48
1 files changed, 31 insertions, 17 deletions
diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c
index 59ae14527ecd..527df7ab1b05 100644
--- a/kernel/irq/chip.c
+++ b/kernel/irq/chip.c
@@ -164,9 +164,21 @@ struct irq_data *irq_get_irq_data(unsigned int irq)
164} 164}
165EXPORT_SYMBOL_GPL(irq_get_irq_data); 165EXPORT_SYMBOL_GPL(irq_get_irq_data);
166 166
167static void irq_state_clr_disabled(struct irq_desc *desc)
168{
169 desc->istate &= ~IRQS_DISABLED;
170 irq_compat_clr_disabled(desc);
171}
172
173static void irq_state_set_disabled(struct irq_desc *desc)
174{
175 desc->istate |= IRQS_DISABLED;
176 irq_compat_set_disabled(desc);
177}
178
167int irq_startup(struct irq_desc *desc) 179int irq_startup(struct irq_desc *desc)
168{ 180{
169 desc->status &= ~IRQ_DISABLED; 181 irq_state_clr_disabled(desc);
170 desc->depth = 0; 182 desc->depth = 0;
171 183
172 if (desc->irq_data.chip->irq_startup) { 184 if (desc->irq_data.chip->irq_startup) {
@@ -181,7 +193,7 @@ int irq_startup(struct irq_desc *desc)
181 193
182void irq_shutdown(struct irq_desc *desc) 194void irq_shutdown(struct irq_desc *desc)
183{ 195{
184 desc->status |= IRQ_DISABLED; 196 irq_state_set_disabled(desc);
185 desc->depth = 1; 197 desc->depth = 1;
186 if (desc->irq_data.chip->irq_shutdown) 198 if (desc->irq_data.chip->irq_shutdown)
187 desc->irq_data.chip->irq_shutdown(&desc->irq_data); 199 desc->irq_data.chip->irq_shutdown(&desc->irq_data);
@@ -194,7 +206,7 @@ void irq_shutdown(struct irq_desc *desc)
194 206
195void irq_enable(struct irq_desc *desc) 207void irq_enable(struct irq_desc *desc)
196{ 208{
197 desc->status &= ~IRQ_DISABLED; 209 irq_state_clr_disabled(desc);
198 if (desc->irq_data.chip->irq_enable) 210 if (desc->irq_data.chip->irq_enable)
199 desc->irq_data.chip->irq_enable(&desc->irq_data); 211 desc->irq_data.chip->irq_enable(&desc->irq_data);
200 else 212 else
@@ -204,7 +216,7 @@ void irq_enable(struct irq_desc *desc)
204 216
205void irq_disable(struct irq_desc *desc) 217void irq_disable(struct irq_desc *desc)
206{ 218{
207 desc->status |= IRQ_DISABLED; 219 irq_state_set_disabled(desc);
208 if (desc->irq_data.chip->irq_disable) { 220 if (desc->irq_data.chip->irq_disable) {
209 desc->irq_data.chip->irq_disable(&desc->irq_data); 221 desc->irq_data.chip->irq_disable(&desc->irq_data);
210 desc->status |= IRQ_MASKED; 222 desc->status |= IRQ_MASKED;
@@ -380,7 +392,7 @@ void handle_nested_irq(unsigned int irq)
380 kstat_incr_irqs_this_cpu(irq, desc); 392 kstat_incr_irqs_this_cpu(irq, desc);
381 393
382 action = desc->action; 394 action = desc->action;
383 if (unlikely(!action || (desc->status & IRQ_DISABLED))) 395 if (unlikely(!action || (desc->istate & IRQS_DISABLED)))
384 goto out_unlock; 396 goto out_unlock;
385 397
386 irq_compat_set_progress(desc); 398 irq_compat_set_progress(desc);
@@ -431,7 +443,7 @@ handle_simple_irq(unsigned int irq, struct irq_desc *desc)
431 desc->istate &= ~(IRQS_REPLAY | IRQS_WAITING); 443 desc->istate &= ~(IRQS_REPLAY | IRQS_WAITING);
432 kstat_incr_irqs_this_cpu(irq, desc); 444 kstat_incr_irqs_this_cpu(irq, desc);
433 445
434 if (unlikely(!desc->action || (desc->status & IRQ_DISABLED))) 446 if (unlikely(!desc->action || (desc->istate & IRQS_DISABLED)))
435 goto out_unlock; 447 goto out_unlock;
436 448
437 handle_irq_event(desc); 449 handle_irq_event(desc);
@@ -467,12 +479,12 @@ handle_level_irq(unsigned int irq, struct irq_desc *desc)
467 * If its disabled or no action available 479 * If its disabled or no action available
468 * keep it masked and get out of here 480 * keep it masked and get out of here
469 */ 481 */
470 if (unlikely(!desc->action || (desc->status & IRQ_DISABLED))) 482 if (unlikely(!desc->action || (desc->istate & IRQS_DISABLED)))
471 goto out_unlock; 483 goto out_unlock;
472 484
473 handle_irq_event(desc); 485 handle_irq_event(desc);
474 486
475 if (!(desc->status & IRQ_DISABLED) && !(desc->istate & IRQS_ONESHOT)) 487 if (!(desc->istate & (IRQS_DISABLED | IRQS_ONESHOT)))
476 unmask_irq(desc); 488 unmask_irq(desc);
477out_unlock: 489out_unlock:
478 raw_spin_unlock(&desc->lock); 490 raw_spin_unlock(&desc->lock);
@@ -505,7 +517,7 @@ handle_fasteoi_irq(unsigned int irq, struct irq_desc *desc)
505 * If its disabled or no action available 517 * If its disabled or no action available
506 * then mask it and get out of here: 518 * then mask it and get out of here:
507 */ 519 */
508 if (unlikely(!desc->action || (desc->status & IRQ_DISABLED))) { 520 if (unlikely(!desc->action || (desc->istate & IRQS_DISABLED))) {
509 desc->status |= IRQ_PENDING; 521 desc->status |= IRQ_PENDING;
510 mask_irq(desc); 522 mask_irq(desc);
511 goto out; 523 goto out;
@@ -543,8 +555,8 @@ handle_edge_irq(unsigned int irq, struct irq_desc *desc)
543 * we shouldn't process the IRQ. Mark it pending, handle 555 * we shouldn't process the IRQ. Mark it pending, handle
544 * the necessary masking and go out 556 * the necessary masking and go out
545 */ 557 */
546 if (unlikely((desc->istate & (IRQS_INPROGRESS) || 558 if (unlikely((desc->istate & (IRQS_DISABLED | IRQS_INPROGRESS) ||
547 (desc->status & IRQ_DISABLED) || !desc->action))) { 559 !desc->action))) {
548 if (!irq_check_poll(desc)) { 560 if (!irq_check_poll(desc)) {
549 desc->status |= IRQ_PENDING; 561 desc->status |= IRQ_PENDING;
550 mask_ack_irq(desc); 562 mask_ack_irq(desc);
@@ -567,15 +579,16 @@ handle_edge_irq(unsigned int irq, struct irq_desc *desc)
567 * one, we could have masked the irq. 579 * one, we could have masked the irq.
568 * Renable it, if it was not disabled in meantime. 580 * Renable it, if it was not disabled in meantime.
569 */ 581 */
570 if (unlikely((desc->status & 582 if (unlikely(desc->status & IRQ_PENDING)) {
571 (IRQ_PENDING | IRQ_MASKED | IRQ_DISABLED)) == 583 if (!(desc->istate & IRQS_DISABLED) &&
572 (IRQ_PENDING | IRQ_MASKED))) { 584 (desc->status & IRQ_MASKED))
573 unmask_irq(desc); 585 unmask_irq(desc);
574 } 586 }
575 587
576 handle_irq_event(desc); 588 handle_irq_event(desc);
577 589
578 } while ((desc->status & (IRQ_PENDING | IRQ_DISABLED)) == IRQ_PENDING); 590 } while ((desc->status & IRQ_PENDING) &&
591 !(desc->istate & IRQS_DISABLED));
579 592
580out_unlock: 593out_unlock:
581 raw_spin_unlock(&desc->lock); 594 raw_spin_unlock(&desc->lock);
@@ -639,7 +652,8 @@ __set_irq_handler(unsigned int irq, irq_flow_handler_t handle, int is_chained,
639 if (handle == handle_bad_irq) { 652 if (handle == handle_bad_irq) {
640 if (desc->irq_data.chip != &no_irq_chip) 653 if (desc->irq_data.chip != &no_irq_chip)
641 mask_ack_irq(desc); 654 mask_ack_irq(desc);
642 desc->status |= IRQ_DISABLED; 655 irq_compat_set_disabled(desc);
656 desc->istate |= IRQS_DISABLED;
643 desc->depth = 1; 657 desc->depth = 1;
644 } 658 }
645 desc->handle_irq = handle; 659 desc->handle_irq = handle;