aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2011-02-08 06:17:57 -0500
committerThomas Gleixner <tglx@linutronix.de>2011-02-19 06:58:17 -0500
commit2a0d6fb335d4428285dab2d254911748e6040807 (patch)
tree16090086899df6886436b89cc76e6d0d5b36d083
parentc1594b77e46124bb462f961e536120e471c67446 (diff)
genirq: Move IRQ_PENDING flag to core
Keep status in sync until all users are fixed. Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
-rw-r--r--include/linux/irq.h2
-rw-r--r--kernel/irq/autoprobe.c6
-rw-r--r--kernel/irq/chip.c10
-rw-r--r--kernel/irq/compat.h12
-rw-r--r--kernel/irq/handle.c3
-rw-r--r--kernel/irq/internals.h4
-rw-r--r--kernel/irq/manage.c5
-rw-r--r--kernel/irq/pm.c3
-rw-r--r--kernel/irq/resend.c5
-rw-r--r--kernel/irq/settings.h2
-rw-r--r--kernel/irq/spurious.c5
11 files changed, 40 insertions, 17 deletions
diff --git a/include/linux/irq.h b/include/linux/irq.h
index 32efca71ce88..7ca55c9deba4 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -56,9 +56,9 @@ typedef void (*irq_flow_handler_t)(unsigned int irq,
56#define IRQ_REPLAY 0x00000200 /* DEPRECATED */ 56#define IRQ_REPLAY 0x00000200 /* DEPRECATED */
57#define IRQ_WAITING 0x00000400 /* DEPRECATED */ 57#define IRQ_WAITING 0x00000400 /* DEPRECATED */
58#define IRQ_DISABLED 0x00000800 /* DEPRECATED */ 58#define IRQ_DISABLED 0x00000800 /* DEPRECATED */
59#define IRQ_PENDING 0x00001000 /* DEPRECATED */
59#endif 60#endif
60 61
61#define IRQ_PENDING 0x00001000 /* IRQ pending - replay on enable */
62 62
63#define IRQ_LEVEL 0x00004000 /* IRQ level triggered */ 63#define IRQ_LEVEL 0x00004000 /* IRQ level triggered */
64#define IRQ_MASKED 0x00008000 /* IRQ masked - shouldn't be seen again */ 64#define IRQ_MASKED 0x00008000 /* IRQ masked - shouldn't be seen again */
diff --git a/kernel/irq/autoprobe.c b/kernel/irq/autoprobe.c
index 9ea8bb99f7c1..aab64c262726 100644
--- a/kernel/irq/autoprobe.c
+++ b/kernel/irq/autoprobe.c
@@ -76,8 +76,10 @@ unsigned long probe_irq_on(void)
76 raw_spin_lock_irq(&desc->lock); 76 raw_spin_lock_irq(&desc->lock);
77 if (!desc->action && !(desc->status & IRQ_NOPROBE)) { 77 if (!desc->action && !(desc->status & IRQ_NOPROBE)) {
78 desc->istate |= IRQS_AUTODETECT | IRQS_WAITING; 78 desc->istate |= IRQS_AUTODETECT | IRQS_WAITING;
79 if (irq_startup(desc)) 79 if (irq_startup(desc)) {
80 desc->status |= IRQ_PENDING; 80 irq_compat_set_pending(desc);
81 desc->istate |= IRQS_PENDING;
82 }
81 } 83 }
82 raw_spin_unlock_irq(&desc->lock); 84 raw_spin_unlock_irq(&desc->lock);
83 } 85 }
diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c
index 527df7ab1b05..17c87865bfb1 100644
--- a/kernel/irq/chip.c
+++ b/kernel/irq/chip.c
@@ -518,7 +518,8 @@ handle_fasteoi_irq(unsigned int irq, struct irq_desc *desc)
518 * then mask it and get out of here: 518 * then mask it and get out of here:
519 */ 519 */
520 if (unlikely(!desc->action || (desc->istate & IRQS_DISABLED))) { 520 if (unlikely(!desc->action || (desc->istate & IRQS_DISABLED))) {
521 desc->status |= IRQ_PENDING; 521 irq_compat_set_pending(desc);
522 desc->istate |= IRQS_PENDING;
522 mask_irq(desc); 523 mask_irq(desc);
523 goto out; 524 goto out;
524 } 525 }
@@ -558,7 +559,8 @@ handle_edge_irq(unsigned int irq, struct irq_desc *desc)
558 if (unlikely((desc->istate & (IRQS_DISABLED | IRQS_INPROGRESS) || 559 if (unlikely((desc->istate & (IRQS_DISABLED | IRQS_INPROGRESS) ||
559 !desc->action))) { 560 !desc->action))) {
560 if (!irq_check_poll(desc)) { 561 if (!irq_check_poll(desc)) {
561 desc->status |= IRQ_PENDING; 562 irq_compat_set_pending(desc);
563 desc->istate |= IRQS_PENDING;
562 mask_ack_irq(desc); 564 mask_ack_irq(desc);
563 goto out_unlock; 565 goto out_unlock;
564 } 566 }
@@ -579,7 +581,7 @@ handle_edge_irq(unsigned int irq, struct irq_desc *desc)
579 * one, we could have masked the irq. 581 * one, we could have masked the irq.
580 * Renable it, if it was not disabled in meantime. 582 * Renable it, if it was not disabled in meantime.
581 */ 583 */
582 if (unlikely(desc->status & IRQ_PENDING)) { 584 if (unlikely(desc->istate & IRQS_PENDING)) {
583 if (!(desc->istate & IRQS_DISABLED) && 585 if (!(desc->istate & IRQS_DISABLED) &&
584 (desc->status & IRQ_MASKED)) 586 (desc->status & IRQ_MASKED))
585 unmask_irq(desc); 587 unmask_irq(desc);
@@ -587,7 +589,7 @@ handle_edge_irq(unsigned int irq, struct irq_desc *desc)
587 589
588 handle_irq_event(desc); 590 handle_irq_event(desc);
589 591
590 } while ((desc->status & IRQ_PENDING) && 592 } while ((desc->istate & IRQS_PENDING) &&
591 !(desc->istate & IRQS_DISABLED)); 593 !(desc->istate & IRQS_DISABLED));
592 594
593out_unlock: 595out_unlock:
diff --git a/kernel/irq/compat.h b/kernel/irq/compat.h
index bc0c2a501e82..0067a69781f4 100644
--- a/kernel/irq/compat.h
+++ b/kernel/irq/compat.h
@@ -15,15 +15,25 @@ static inline void irq_compat_set_disabled(struct irq_desc *desc)
15{ 15{
16 desc->status |= IRQ_DISABLED; 16 desc->status |= IRQ_DISABLED;
17} 17}
18
19static inline void irq_compat_clr_disabled(struct irq_desc *desc) 18static inline void irq_compat_clr_disabled(struct irq_desc *desc)
20{ 19{
21 desc->status &= ~IRQ_DISABLED; 20 desc->status &= ~IRQ_DISABLED;
22} 21}
22static inline void irq_compat_set_pending(struct irq_desc *desc)
23{
24 desc->status |= IRQ_PENDING;
25}
26
27static inline void irq_compat_clr_pending(struct irq_desc *desc)
28{
29 desc->status &= ~IRQ_PENDING;
30}
23#else 31#else
24static inline void irq_compat_set_progress(struct irq_desc *desc) { } 32static inline void irq_compat_set_progress(struct irq_desc *desc) { }
25static inline void irq_compat_clr_progress(struct irq_desc *desc) { } 33static inline void irq_compat_clr_progress(struct irq_desc *desc) { }
26static inline void irq_compat_set_disabled(struct irq_desc *desc) { } 34static inline void irq_compat_set_disabled(struct irq_desc *desc) { }
27static inline void irq_compat_clr_disabled(struct irq_desc *desc) { } 35static inline void irq_compat_clr_disabled(struct irq_desc *desc) { }
36static inline void irq_compat_set_pending(struct irq_desc *desc) { }
37static inline void irq_compat_clr_pending(struct irq_desc *desc) { }
28#endif 38#endif
29 39
diff --git a/kernel/irq/handle.c b/kernel/irq/handle.c
index d4ae0b1ccc00..6e34bdbeb26a 100644
--- a/kernel/irq/handle.c
+++ b/kernel/irq/handle.c
@@ -122,7 +122,8 @@ irqreturn_t handle_irq_event(struct irq_desc *desc)
122 struct irqaction *action = desc->action; 122 struct irqaction *action = desc->action;
123 irqreturn_t ret; 123 irqreturn_t ret;
124 124
125 desc->status &= ~IRQ_PENDING; 125 irq_compat_clr_pending(desc);
126 desc->istate &= ~IRQS_PENDING;
126 irq_compat_set_progress(desc); 127 irq_compat_set_progress(desc);
127 desc->istate |= IRQS_INPROGRESS; 128 desc->istate |= IRQS_INPROGRESS;
128 raw_spin_unlock(&desc->lock); 129 raw_spin_unlock(&desc->lock);
diff --git a/kernel/irq/internals.h b/kernel/irq/internals.h
index 919d2dd0bb33..fdf2524437eb 100644
--- a/kernel/irq/internals.h
+++ b/kernel/irq/internals.h
@@ -46,6 +46,7 @@ enum {
46 * IRQS_REPLAY - irq is replayed 46 * IRQS_REPLAY - irq is replayed
47 * IRQS_WAITING - irq is waiting 47 * IRQS_WAITING - irq is waiting
48 * IRQS_DISABLED - irq is disabled 48 * IRQS_DISABLED - irq is disabled
49 * IRQS_PENDING - irq is pending and replayed later
49 */ 50 */
50enum { 51enum {
51 IRQS_AUTODETECT = 0x00000001, 52 IRQS_AUTODETECT = 0x00000001,
@@ -56,6 +57,7 @@ enum {
56 IRQS_REPLAY = 0x00000040, 57 IRQS_REPLAY = 0x00000040,
57 IRQS_WAITING = 0x00000080, 58 IRQS_WAITING = 0x00000080,
58 IRQS_DISABLED = 0x00000100, 59 IRQS_DISABLED = 0x00000100,
60 IRQS_PENDING = 0x00000200,
59}; 61};
60 62
61#define irq_data_to_desc(data) container_of(data, struct irq_desc, irq_data) 63#define irq_data_to_desc(data) container_of(data, struct irq_desc, irq_data)
@@ -139,7 +141,6 @@ static inline void print_irq_desc(unsigned int irq, struct irq_desc *desc)
139 print_symbol("%s\n", (unsigned long)desc->action->handler); 141 print_symbol("%s\n", (unsigned long)desc->action->handler);
140 } 142 }
141 143
142 P(IRQ_PENDING);
143 P(IRQ_LEVEL); 144 P(IRQ_LEVEL);
144 P(IRQ_MASKED); 145 P(IRQ_MASKED);
145#ifdef CONFIG_IRQ_PER_CPU 146#ifdef CONFIG_IRQ_PER_CPU
@@ -154,6 +155,7 @@ static inline void print_irq_desc(unsigned int irq, struct irq_desc *desc)
154 PS(IRQS_REPLAY); 155 PS(IRQS_REPLAY);
155 PS(IRQS_WAITING); 156 PS(IRQS_WAITING);
156 PS(IRQS_DISABLED); 157 PS(IRQS_DISABLED);
158 PS(IRQS_PENDING);
157} 159}
158 160
159#undef P 161#undef P
diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
index 77ff275b54cf..ac060814a787 100644
--- a/kernel/irq/manage.c
+++ b/kernel/irq/manage.c
@@ -714,10 +714,11 @@ static int irq_thread(void *data)
714 * CHECKME: We might need a dedicated 714 * CHECKME: We might need a dedicated
715 * IRQ_THREAD_PENDING flag here, which 715 * IRQ_THREAD_PENDING flag here, which
716 * retriggers the thread in check_irq_resend() 716 * retriggers the thread in check_irq_resend()
717 * but AFAICT IRQ_PENDING should be fine as it 717 * but AFAICT IRQS_PENDING should be fine as it
718 * retriggers the interrupt itself --- tglx 718 * retriggers the interrupt itself --- tglx
719 */ 719 */
720 desc->status |= IRQ_PENDING; 720 irq_compat_set_pending(desc);
721 desc->istate |= IRQS_PENDING;
721 raw_spin_unlock_irq(&desc->lock); 722 raw_spin_unlock_irq(&desc->lock);
722 } else { 723 } else {
723 raw_spin_unlock_irq(&desc->lock); 724 raw_spin_unlock_irq(&desc->lock);
diff --git a/kernel/irq/pm.c b/kernel/irq/pm.c
index d6bfb89cce91..d7389418e91a 100644
--- a/kernel/irq/pm.c
+++ b/kernel/irq/pm.c
@@ -69,7 +69,8 @@ int check_wakeup_irqs(void)
69 int irq; 69 int irq;
70 70
71 for_each_irq_desc(irq, desc) 71 for_each_irq_desc(irq, desc)
72 if ((desc->status & IRQ_WAKEUP) && (desc->status & IRQ_PENDING)) 72 if ((desc->status & IRQ_WAKEUP) &&
73 (desc->istate & IRQS_PENDING))
73 return -EBUSY; 74 return -EBUSY;
74 75
75 return 0; 76 return 0;
diff --git a/kernel/irq/resend.c b/kernel/irq/resend.c
index f83387cd11f3..ff1fea060014 100644
--- a/kernel/irq/resend.c
+++ b/kernel/irq/resend.c
@@ -64,8 +64,9 @@ void check_irq_resend(struct irq_desc *desc, unsigned int irq)
64 return; 64 return;
65 if (desc->istate & IRQS_REPLAY) 65 if (desc->istate & IRQS_REPLAY)
66 return; 66 return;
67 if (desc->status & IRQ_PENDING) { 67 if (desc->istate & IRQS_PENDING) {
68 desc->status &= ~IRQ_PENDING; 68 irq_compat_clr_pending(desc);
69 desc->istate &= ~IRQS_PENDING;
69 desc->istate |= IRQS_REPLAY; 70 desc->istate |= IRQS_REPLAY;
70 71
71 if (!desc->irq_data.chip->irq_retrigger || 72 if (!desc->irq_data.chip->irq_retrigger ||
diff --git a/kernel/irq/settings.h b/kernel/irq/settings.h
index 5e3411c7c62b..623fcf83e7de 100644
--- a/kernel/irq/settings.h
+++ b/kernel/irq/settings.h
@@ -14,3 +14,5 @@ enum {
14#define IRQ_WAITING GOT_YOU_MORON 14#define IRQ_WAITING GOT_YOU_MORON
15#undef IRQ_DISABLED 15#undef IRQ_DISABLED
16#define IRQ_DISABLED GOT_YOU_MORON 16#define IRQ_DISABLED GOT_YOU_MORON
17#undef IRQ_PENDING
18#define IRQ_PENDING GOT_YOU_MORON
diff --git a/kernel/irq/spurious.c b/kernel/irq/spurious.c
index 367614f858ff..692ce2bae302 100644
--- a/kernel/irq/spurious.c
+++ b/kernel/irq/spurious.c
@@ -93,7 +93,8 @@ static int try_one_irq(int irq, struct irq_desc *desc, bool force)
93 * Already running: If it is shared get the other 93 * Already running: If it is shared get the other
94 * CPU to go looking for our mystery interrupt too 94 * CPU to go looking for our mystery interrupt too
95 */ 95 */
96 desc->status |= IRQ_PENDING; 96 irq_compat_set_pending(desc);
97 desc->istate |= IRQS_PENDING;
97 goto out; 98 goto out;
98 } 99 }
99 100
@@ -103,7 +104,7 @@ static int try_one_irq(int irq, struct irq_desc *desc, bool force)
103 if (handle_irq_event(desc) == IRQ_HANDLED) 104 if (handle_irq_event(desc) == IRQ_HANDLED)
104 ret = IRQ_HANDLED; 105 ret = IRQ_HANDLED;
105 action = desc->action; 106 action = desc->action;
106 } while ((desc->status & IRQ_PENDING) && action); 107 } while ((desc->istate & IRQS_PENDING) && action);
107 desc->istate &= ~IRQS_POLL_INPROGRESS; 108 desc->istate &= ~IRQS_POLL_INPROGRESS;
108out: 109out:
109 raw_spin_unlock(&desc->lock); 110 raw_spin_unlock(&desc->lock);