aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2011-03-28 08:10:52 -0400
committerThomas Gleixner <tglx@linutronix.de>2011-03-28 10:55:10 -0400
commit32f4125ebffee4f3c4dbc6a437fc656129eb9e60 (patch)
treed64c6bb7ba40c33734896303734416ea5b4f3290
parentc2d0c555c22242c3a76e366074c4d83ef9fa3b8c (diff)
genirq: Move INPROGRESS, MASKED and DISABLED state flags to irq_data
We really need these flags for some of the interrupt chips. Move it from internal state to irq_data and provide proper accessors. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Cc: David Daney <ddaney@caviumnetworks.com>
-rw-r--r--include/linux/irq.h17
-rw-r--r--kernel/irq/chip.c40
-rw-r--r--kernel/irq/debug.h10
-rw-r--r--kernel/irq/handle.c4
-rw-r--r--kernel/irq/internals.h6
-rw-r--r--kernel/irq/irqdesc.c2
-rw-r--r--kernel/irq/manage.c30
-rw-r--r--kernel/irq/migration.c4
-rw-r--r--kernel/irq/spurious.c10
9 files changed, 64 insertions, 59 deletions
diff --git a/include/linux/irq.h b/include/linux/irq.h
index a10717e1c1f3..18aacccb0fae 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -174,8 +174,9 @@ struct irq_data {
174 * from suspend 174 * from suspend
175 * IRDQ_MOVE_PCNTXT - Interrupt can be moved in process 175 * IRDQ_MOVE_PCNTXT - Interrupt can be moved in process
176 * context 176 * context
177 * IRQD_IRQ_DISABLED - Some chip function need to know the 177 * IRQD_IRQ_DISABLED - Disabled state of the interrupt
178 * disabled state. 178 * IRQD_IRQ_MASKED - Masked state of the interrupt
179 * IRQD_IRQ_INPROGRESS - In progress state of the interrupt
179 */ 180 */
180enum { 181enum {
181 IRQD_TRIGGER_MASK = 0xf, 182 IRQD_TRIGGER_MASK = 0xf,
@@ -187,6 +188,8 @@ enum {
187 IRQD_WAKEUP_STATE = (1 << 14), 188 IRQD_WAKEUP_STATE = (1 << 14),
188 IRQD_MOVE_PCNTXT = (1 << 15), 189 IRQD_MOVE_PCNTXT = (1 << 15),
189 IRQD_IRQ_DISABLED = (1 << 16), 190 IRQD_IRQ_DISABLED = (1 << 16),
191 IRQD_IRQ_MASKED = (1 << 17),
192 IRQD_IRQ_INPROGRESS = (1 << 18),
190}; 193};
191 194
192static inline bool irqd_is_setaffinity_pending(struct irq_data *d) 195static inline bool irqd_is_setaffinity_pending(struct irq_data *d)
@@ -243,6 +246,16 @@ static inline bool irqd_irq_disabled(struct irq_data *d)
243 return d->state_use_accessors & IRQD_IRQ_DISABLED; 246 return d->state_use_accessors & IRQD_IRQ_DISABLED;
244} 247}
245 248
249static inline bool irqd_irq_masked(struct irq_data *d)
250{
251 return d->state_use_accessors & IRQD_IRQ_MASKED;
252}
253
254static inline bool irqd_irq_inprogress(struct irq_data *d)
255{
256 return d->state_use_accessors & IRQD_IRQ_INPROGRESS;
257}
258
246/** 259/**
247 * struct irq_chip - hardware interrupt chip descriptor 260 * struct irq_chip - hardware interrupt chip descriptor
248 * 261 *
diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c
index 9283d3300ea9..e00bdc56269f 100644
--- a/kernel/irq/chip.c
+++ b/kernel/irq/chip.c
@@ -140,27 +140,25 @@ EXPORT_SYMBOL_GPL(irq_get_irq_data);
140 140
141static void irq_state_clr_disabled(struct irq_desc *desc) 141static void irq_state_clr_disabled(struct irq_desc *desc)
142{ 142{
143 desc->istate &= ~IRQS_DISABLED;
144 irqd_clear(&desc->irq_data, IRQD_IRQ_DISABLED); 143 irqd_clear(&desc->irq_data, IRQD_IRQ_DISABLED);
145 irq_compat_clr_disabled(desc); 144 irq_compat_clr_disabled(desc);
146} 145}
147 146
148static void irq_state_set_disabled(struct irq_desc *desc) 147static void irq_state_set_disabled(struct irq_desc *desc)
149{ 148{
150 desc->istate |= IRQS_DISABLED;
151 irqd_set(&desc->irq_data, IRQD_IRQ_DISABLED); 149 irqd_set(&desc->irq_data, IRQD_IRQ_DISABLED);
152 irq_compat_set_disabled(desc); 150 irq_compat_set_disabled(desc);
153} 151}
154 152
155static void irq_state_clr_masked(struct irq_desc *desc) 153static void irq_state_clr_masked(struct irq_desc *desc)
156{ 154{
157 desc->istate &= ~IRQS_MASKED; 155 irqd_clear(&desc->irq_data, IRQD_IRQ_MASKED);
158 irq_compat_clr_masked(desc); 156 irq_compat_clr_masked(desc);
159} 157}
160 158
161static void irq_state_set_masked(struct irq_desc *desc) 159static void irq_state_set_masked(struct irq_desc *desc)
162{ 160{
163 desc->istate |= IRQS_MASKED; 161 irqd_set(&desc->irq_data, IRQD_IRQ_MASKED);
164 irq_compat_set_masked(desc); 162 irq_compat_set_masked(desc);
165} 163}
166 164
@@ -380,11 +378,11 @@ void handle_nested_irq(unsigned int irq)
380 kstat_incr_irqs_this_cpu(irq, desc); 378 kstat_incr_irqs_this_cpu(irq, desc);
381 379
382 action = desc->action; 380 action = desc->action;
383 if (unlikely(!action || (desc->istate & IRQS_DISABLED))) 381 if (unlikely(!action || irqd_irq_disabled(&desc->irq_data)))
384 goto out_unlock; 382 goto out_unlock;
385 383
386 irq_compat_set_progress(desc); 384 irq_compat_set_progress(desc);
387 desc->istate |= IRQS_INPROGRESS; 385 irqd_set(&desc->irq_data, IRQD_IRQ_INPROGRESS);
388 raw_spin_unlock_irq(&desc->lock); 386 raw_spin_unlock_irq(&desc->lock);
389 387
390 action_ret = action->thread_fn(action->irq, action->dev_id); 388 action_ret = action->thread_fn(action->irq, action->dev_id);
@@ -392,7 +390,7 @@ void handle_nested_irq(unsigned int irq)
392 note_interrupt(irq, desc, action_ret); 390 note_interrupt(irq, desc, action_ret);
393 391
394 raw_spin_lock_irq(&desc->lock); 392 raw_spin_lock_irq(&desc->lock);
395 desc->istate &= ~IRQS_INPROGRESS; 393 irqd_clear(&desc->irq_data, IRQD_IRQ_INPROGRESS);
396 irq_compat_clr_progress(desc); 394 irq_compat_clr_progress(desc);
397 395
398out_unlock: 396out_unlock:
@@ -424,14 +422,14 @@ handle_simple_irq(unsigned int irq, struct irq_desc *desc)
424{ 422{
425 raw_spin_lock(&desc->lock); 423 raw_spin_lock(&desc->lock);
426 424
427 if (unlikely(desc->istate & IRQS_INPROGRESS)) 425 if (unlikely(irqd_irq_inprogress(&desc->irq_data)))
428 if (!irq_check_poll(desc)) 426 if (!irq_check_poll(desc))
429 goto out_unlock; 427 goto out_unlock;
430 428
431 desc->istate &= ~(IRQS_REPLAY | IRQS_WAITING); 429 desc->istate &= ~(IRQS_REPLAY | IRQS_WAITING);
432 kstat_incr_irqs_this_cpu(irq, desc); 430 kstat_incr_irqs_this_cpu(irq, desc);
433 431
434 if (unlikely(!desc->action || (desc->istate & IRQS_DISABLED))) 432 if (unlikely(!desc->action || irqd_irq_disabled(&desc->irq_data)))
435 goto out_unlock; 433 goto out_unlock;
436 434
437 handle_irq_event(desc); 435 handle_irq_event(desc);
@@ -456,7 +454,7 @@ handle_level_irq(unsigned int irq, struct irq_desc *desc)
456 raw_spin_lock(&desc->lock); 454 raw_spin_lock(&desc->lock);
457 mask_ack_irq(desc); 455 mask_ack_irq(desc);
458 456
459 if (unlikely(desc->istate & IRQS_INPROGRESS)) 457 if (unlikely(irqd_irq_inprogress(&desc->irq_data)))
460 if (!irq_check_poll(desc)) 458 if (!irq_check_poll(desc))
461 goto out_unlock; 459 goto out_unlock;
462 460
@@ -467,12 +465,12 @@ handle_level_irq(unsigned int irq, struct irq_desc *desc)
467 * If its disabled or no action available 465 * If its disabled or no action available
468 * keep it masked and get out of here 466 * keep it masked and get out of here
469 */ 467 */
470 if (unlikely(!desc->action || (desc->istate & IRQS_DISABLED))) 468 if (unlikely(!desc->action || irqd_irq_disabled(&desc->irq_data)))
471 goto out_unlock; 469 goto out_unlock;
472 470
473 handle_irq_event(desc); 471 handle_irq_event(desc);
474 472
475 if (!(desc->istate & (IRQS_DISABLED | IRQS_ONESHOT))) 473 if (!irqd_irq_disabled(&desc->irq_data) && !(desc->istate & IRQS_ONESHOT))
476 unmask_irq(desc); 474 unmask_irq(desc);
477out_unlock: 475out_unlock:
478 raw_spin_unlock(&desc->lock); 476 raw_spin_unlock(&desc->lock);
@@ -504,7 +502,7 @@ handle_fasteoi_irq(unsigned int irq, struct irq_desc *desc)
504{ 502{
505 raw_spin_lock(&desc->lock); 503 raw_spin_lock(&desc->lock);
506 504
507 if (unlikely(desc->istate & IRQS_INPROGRESS)) 505 if (unlikely(irqd_irq_inprogress(&desc->irq_data)))
508 if (!irq_check_poll(desc)) 506 if (!irq_check_poll(desc))
509 goto out; 507 goto out;
510 508
@@ -515,7 +513,7 @@ handle_fasteoi_irq(unsigned int irq, struct irq_desc *desc)
515 * If its disabled or no action available 513 * If its disabled or no action available
516 * then mask it and get out of here: 514 * then mask it and get out of here:
517 */ 515 */
518 if (unlikely(!desc->action || (desc->istate & IRQS_DISABLED))) { 516 if (unlikely(!desc->action || irqd_irq_disabled(&desc->irq_data))) {
519 irq_compat_set_pending(desc); 517 irq_compat_set_pending(desc);
520 desc->istate |= IRQS_PENDING; 518 desc->istate |= IRQS_PENDING;
521 mask_irq(desc); 519 mask_irq(desc);
@@ -566,8 +564,8 @@ handle_edge_irq(unsigned int irq, struct irq_desc *desc)
566 * we shouldn't process the IRQ. Mark it pending, handle 564 * we shouldn't process the IRQ. Mark it pending, handle
567 * the necessary maski