提交 2a0d6fb3 编写于 作者: T Thomas Gleixner

genirq: Move IRQ_PENDING flag to core

Keep status in sync until all users are fixed.
Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
上级 c1594b77
...@@ -56,9 +56,9 @@ typedef void (*irq_flow_handler_t)(unsigned int irq, ...@@ -56,9 +56,9 @@ typedef void (*irq_flow_handler_t)(unsigned int irq,
#define IRQ_REPLAY 0x00000200 /* DEPRECATED */ #define IRQ_REPLAY 0x00000200 /* DEPRECATED */
#define IRQ_WAITING 0x00000400 /* DEPRECATED */ #define IRQ_WAITING 0x00000400 /* DEPRECATED */
#define IRQ_DISABLED 0x00000800 /* DEPRECATED */ #define IRQ_DISABLED 0x00000800 /* DEPRECATED */
#define IRQ_PENDING 0x00001000 /* DEPRECATED */
#endif #endif
#define IRQ_PENDING 0x00001000 /* IRQ pending - replay on enable */
#define IRQ_LEVEL 0x00004000 /* IRQ level triggered */ #define IRQ_LEVEL 0x00004000 /* IRQ level triggered */
#define IRQ_MASKED 0x00008000 /* IRQ masked - shouldn't be seen again */ #define IRQ_MASKED 0x00008000 /* IRQ masked - shouldn't be seen again */
......
...@@ -76,8 +76,10 @@ unsigned long probe_irq_on(void) ...@@ -76,8 +76,10 @@ unsigned long probe_irq_on(void)
raw_spin_lock_irq(&desc->lock); raw_spin_lock_irq(&desc->lock);
if (!desc->action && !(desc->status & IRQ_NOPROBE)) { if (!desc->action && !(desc->status & IRQ_NOPROBE)) {
desc->istate |= IRQS_AUTODETECT | IRQS_WAITING; desc->istate |= IRQS_AUTODETECT | IRQS_WAITING;
if (irq_startup(desc)) if (irq_startup(desc)) {
desc->status |= IRQ_PENDING; irq_compat_set_pending(desc);
desc->istate |= IRQS_PENDING;
}
} }
raw_spin_unlock_irq(&desc->lock); raw_spin_unlock_irq(&desc->lock);
} }
......
...@@ -518,7 +518,8 @@ handle_fasteoi_irq(unsigned int irq, struct irq_desc *desc) ...@@ -518,7 +518,8 @@ handle_fasteoi_irq(unsigned int irq, struct irq_desc *desc)
* then mask it and get out of here: * then mask it and get out of here:
*/ */
if (unlikely(!desc->action || (desc->istate & IRQS_DISABLED))) { if (unlikely(!desc->action || (desc->istate & IRQS_DISABLED))) {
desc->status |= IRQ_PENDING; irq_compat_set_pending(desc);
desc->istate |= IRQS_PENDING;
mask_irq(desc); mask_irq(desc);
goto out; goto out;
} }
...@@ -558,7 +559,8 @@ handle_edge_irq(unsigned int irq, struct irq_desc *desc) ...@@ -558,7 +559,8 @@ handle_edge_irq(unsigned int irq, struct irq_desc *desc)
if (unlikely((desc->istate & (IRQS_DISABLED | IRQS_INPROGRESS) || if (unlikely((desc->istate & (IRQS_DISABLED | IRQS_INPROGRESS) ||
!desc->action))) { !desc->action))) {
if (!irq_check_poll(desc)) { if (!irq_check_poll(desc)) {
desc->status |= IRQ_PENDING; irq_compat_set_pending(desc);
desc->istate |= IRQS_PENDING;
mask_ack_irq(desc); mask_ack_irq(desc);
goto out_unlock; goto out_unlock;
} }
...@@ -579,7 +581,7 @@ handle_edge_irq(unsigned int irq, struct irq_desc *desc) ...@@ -579,7 +581,7 @@ handle_edge_irq(unsigned int irq, struct irq_desc *desc)
* one, we could have masked the irq. * one, we could have masked the irq.
* Renable it, if it was not disabled in meantime. * Renable it, if it was not disabled in meantime.
*/ */
if (unlikely(desc->status & IRQ_PENDING)) { if (unlikely(desc->istate & IRQS_PENDING)) {
if (!(desc->istate & IRQS_DISABLED) && if (!(desc->istate & IRQS_DISABLED) &&
(desc->status & IRQ_MASKED)) (desc->status & IRQ_MASKED))
unmask_irq(desc); unmask_irq(desc);
...@@ -587,7 +589,7 @@ handle_edge_irq(unsigned int irq, struct irq_desc *desc) ...@@ -587,7 +589,7 @@ handle_edge_irq(unsigned int irq, struct irq_desc *desc)
handle_irq_event(desc); handle_irq_event(desc);
} while ((desc->status & IRQ_PENDING) && } while ((desc->istate & IRQS_PENDING) &&
!(desc->istate & IRQS_DISABLED)); !(desc->istate & IRQS_DISABLED));
out_unlock: out_unlock:
......
...@@ -15,15 +15,25 @@ static inline void irq_compat_set_disabled(struct irq_desc *desc) ...@@ -15,15 +15,25 @@ static inline void irq_compat_set_disabled(struct irq_desc *desc)
{ {
desc->status |= IRQ_DISABLED; desc->status |= IRQ_DISABLED;
} }
static inline void irq_compat_clr_disabled(struct irq_desc *desc) static inline void irq_compat_clr_disabled(struct irq_desc *desc)
{ {
desc->status &= ~IRQ_DISABLED; desc->status &= ~IRQ_DISABLED;
} }
static inline void irq_compat_set_pending(struct irq_desc *desc)
{
desc->status |= IRQ_PENDING;
}
static inline void irq_compat_clr_pending(struct irq_desc *desc)
{
desc->status &= ~IRQ_PENDING;
}
#else #else
static inline void irq_compat_set_progress(struct irq_desc *desc) { } static inline void irq_compat_set_progress(struct irq_desc *desc) { }
static inline void irq_compat_clr_progress(struct irq_desc *desc) { } static inline void irq_compat_clr_progress(struct irq_desc *desc) { }
static inline void irq_compat_set_disabled(struct irq_desc *desc) { } static inline void irq_compat_set_disabled(struct irq_desc *desc) { }
static inline void irq_compat_clr_disabled(struct irq_desc *desc) { } static inline void irq_compat_clr_disabled(struct irq_desc *desc) { }
static inline void irq_compat_set_pending(struct irq_desc *desc) { }
static inline void irq_compat_clr_pending(struct irq_desc *desc) { }
#endif #endif
...@@ -122,7 +122,8 @@ irqreturn_t handle_irq_event(struct irq_desc *desc) ...@@ -122,7 +122,8 @@ irqreturn_t handle_irq_event(struct irq_desc *desc)
struct irqaction *action = desc->action; struct irqaction *action = desc->action;
irqreturn_t ret; irqreturn_t ret;
desc->status &= ~IRQ_PENDING; irq_compat_clr_pending(desc);
desc->istate &= ~IRQS_PENDING;
irq_compat_set_progress(desc); irq_compat_set_progress(desc);
desc->istate |= IRQS_INPROGRESS; desc->istate |= IRQS_INPROGRESS;
raw_spin_unlock(&desc->lock); raw_spin_unlock(&desc->lock);
......
...@@ -46,6 +46,7 @@ enum { ...@@ -46,6 +46,7 @@ enum {
* IRQS_REPLAY - irq is replayed * IRQS_REPLAY - irq is replayed
* IRQS_WAITING - irq is waiting * IRQS_WAITING - irq is waiting
* IRQS_DISABLED - irq is disabled * IRQS_DISABLED - irq is disabled
* IRQS_PENDING - irq is pending and replayed later
*/ */
enum { enum {
IRQS_AUTODETECT = 0x00000001, IRQS_AUTODETECT = 0x00000001,
...@@ -56,6 +57,7 @@ enum { ...@@ -56,6 +57,7 @@ enum {
IRQS_REPLAY = 0x00000040, IRQS_REPLAY = 0x00000040,
IRQS_WAITING = 0x00000080, IRQS_WAITING = 0x00000080,
IRQS_DISABLED = 0x00000100, IRQS_DISABLED = 0x00000100,
IRQS_PENDING = 0x00000200,
}; };
#define irq_data_to_desc(data) container_of(data, struct irq_desc, irq_data) #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,7 +141,6 @@ static inline void print_irq_desc(unsigned int irq, struct irq_desc *desc)
print_symbol("%s\n", (unsigned long)desc->action->handler); print_symbol("%s\n", (unsigned long)desc->action->handler);
} }
P(IRQ_PENDING);
P(IRQ_LEVEL); P(IRQ_LEVEL);
P(IRQ_MASKED); P(IRQ_MASKED);
#ifdef CONFIG_IRQ_PER_CPU #ifdef CONFIG_IRQ_PER_CPU
...@@ -154,6 +155,7 @@ static inline void print_irq_desc(unsigned int irq, struct irq_desc *desc) ...@@ -154,6 +155,7 @@ static inline void print_irq_desc(unsigned int irq, struct irq_desc *desc)
PS(IRQS_REPLAY); PS(IRQS_REPLAY);
PS(IRQS_WAITING); PS(IRQS_WAITING);
PS(IRQS_DISABLED); PS(IRQS_DISABLED);
PS(IRQS_PENDING);
} }
#undef P #undef P
......
...@@ -714,10 +714,11 @@ static int irq_thread(void *data) ...@@ -714,10 +714,11 @@ static int irq_thread(void *data)
* CHECKME: We might need a dedicated * CHECKME: We might need a dedicated
* IRQ_THREAD_PENDING flag here, which * IRQ_THREAD_PENDING flag here, which
* retriggers the thread in check_irq_resend() * retriggers the thread in check_irq_resend()
* but AFAICT IRQ_PENDING should be fine as it * but AFAICT IRQS_PENDING should be fine as it
* retriggers the interrupt itself --- tglx * retriggers the interrupt itself --- tglx
*/ */
desc->status |= IRQ_PENDING; irq_compat_set_pending(desc);
desc->istate |= IRQS_PENDING;
raw_spin_unlock_irq(&desc->lock); raw_spin_unlock_irq(&desc->lock);
} else { } else {
raw_spin_unlock_irq(&desc->lock); raw_spin_unlock_irq(&desc->lock);
......
...@@ -69,7 +69,8 @@ int check_wakeup_irqs(void) ...@@ -69,7 +69,8 @@ int check_wakeup_irqs(void)
int irq; int irq;
for_each_irq_desc(irq, desc) for_each_irq_desc(irq, desc)
if ((desc->status & IRQ_WAKEUP) && (desc->status & IRQ_PENDING)) if ((desc->status & IRQ_WAKEUP) &&
(desc->istate & IRQS_PENDING))
return -EBUSY; return -EBUSY;
return 0; return 0;
......
...@@ -64,8 +64,9 @@ void check_irq_resend(struct irq_desc *desc, unsigned int irq) ...@@ -64,8 +64,9 @@ void check_irq_resend(struct irq_desc *desc, unsigned int irq)
return; return;
if (desc->istate & IRQS_REPLAY) if (desc->istate & IRQS_REPLAY)
return; return;
if (desc->status & IRQ_PENDING) { if (desc->istate & IRQS_PENDING) {
desc->status &= ~IRQ_PENDING; irq_compat_clr_pending(desc);
desc->istate &= ~IRQS_PENDING;
desc->istate |= IRQS_REPLAY; desc->istate |= IRQS_REPLAY;
if (!desc->irq_data.chip->irq_retrigger || if (!desc->irq_data.chip->irq_retrigger ||
......
...@@ -14,3 +14,5 @@ enum { ...@@ -14,3 +14,5 @@ enum {
#define IRQ_WAITING GOT_YOU_MORON #define IRQ_WAITING GOT_YOU_MORON
#undef IRQ_DISABLED #undef IRQ_DISABLED
#define IRQ_DISABLED GOT_YOU_MORON #define IRQ_DISABLED GOT_YOU_MORON
#undef IRQ_PENDING
#define IRQ_PENDING GOT_YOU_MORON
...@@ -93,7 +93,8 @@ static int try_one_irq(int irq, struct irq_desc *desc, bool force) ...@@ -93,7 +93,8 @@ static int try_one_irq(int irq, struct irq_desc *desc, bool force)
* Already running: If it is shared get the other * Already running: If it is shared get the other
* CPU to go looking for our mystery interrupt too * CPU to go looking for our mystery interrupt too
*/ */
desc->status |= IRQ_PENDING; irq_compat_set_pending(desc);
desc->istate |= IRQS_PENDING;
goto out; goto out;
} }
...@@ -103,7 +104,7 @@ static int try_one_irq(int irq, struct irq_desc *desc, bool force) ...@@ -103,7 +104,7 @@ static int try_one_irq(int irq, struct irq_desc *desc, bool force)
if (handle_irq_event(desc) == IRQ_HANDLED) if (handle_irq_event(desc) == IRQ_HANDLED)
ret = IRQ_HANDLED; ret = IRQ_HANDLED;
action = desc->action; action = desc->action;
} while ((desc->status & IRQ_PENDING) && action); } while ((desc->istate & IRQS_PENDING) && action);
desc->istate &= ~IRQS_POLL_INPROGRESS; desc->istate &= ~IRQS_POLL_INPROGRESS;
out: out:
raw_spin_unlock(&desc->lock); raw_spin_unlock(&desc->lock);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册