diff options
author | Daniel Lezcano <daniel.lezcano@linaro.org> | 2016-01-13 20:12:37 +0100 |
---|---|---|
committer | Daniel Lezcano <daniel.lezcano@linaro.org> | 2016-01-13 21:51:57 +0100 |
commit | 59fc421e62644f5c4f5a457ed9325982119f0d82 (patch) | |
tree | 5782014b4b58a6b789e2c5d8f33fedc37d256909 | |
parent | a1381a23caf55cd9a3c6ff37546120598287f35c (diff) |
irq: Use a common macro to go through the action list
The irq code browses the list of actions differently to inspect the element
one by one. Even if it is not a problem, for the sake of lisibility and
to unification of the code, provide a macro similar to for_each_irq_desc in
order to have the same action loop across the code.
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
-rw-r--r-- | kernel/irq/handle.c | 11 | ||||
-rw-r--r-- | kernel/irq/internals.h | 3 | ||||
-rw-r--r-- | kernel/irq/manage.c | 8 | ||||
-rw-r--r-- | kernel/irq/proc.c | 2 | ||||
-rw-r--r-- | kernel/irq/spurious.c | 4 |
5 files changed, 13 insertions, 15 deletions
diff --git a/kernel/irq/handle.c b/kernel/irq/handle.c index ca8b0c5ba66e..445a98c1a21b 100644 --- a/kernel/irq/handle.c +++ b/kernel/irq/handle.c @@ -144,12 +144,13 @@ void handle_irqt_event(struct irqtimings *irqt, struct irqaction *action) #endif irqreturn_t -handle_irq_event_percpu(struct irq_desc *desc, struct irqaction *action) +handle_irq_event_percpu(struct irq_desc *desc) { irqreturn_t retval = IRQ_NONE; unsigned int flags = 0, irq = desc->irq_data.irq; + struct irqaction *action; - do { + for_each_desc_action(desc, action) { irqreturn_t res; trace_irq_handler_entry(irq, action); @@ -184,8 +185,7 @@ handle_irq_event_percpu(struct irq_desc *desc, struct irqaction *action) } retval |= res; - action = action->next; - } while (action); + } add_interrupt_randomness(irq, flags); @@ -196,14 +196,13 @@ handle_irq_event_percpu(struct irq_desc *desc, struct irqaction *action) irqreturn_t handle_irq_event(struct irq_desc *desc) { - struct irqaction *action = desc->action; irqreturn_t ret; desc->istate &= ~IRQS_PENDING; irqd_set(&desc->irq_data, IRQD_IRQ_INPROGRESS); raw_spin_unlock(&desc->lock); - ret = handle_irq_event_percpu(desc, action); + ret = handle_irq_event_percpu(desc); raw_spin_lock(&desc->lock); irqd_clear(&desc->irq_data, IRQD_IRQ_INPROGRESS); diff --git a/kernel/irq/internals.h b/kernel/irq/internals.h index 5ef0c2dbe930..cfefc55e4905 100644 --- a/kernel/irq/internals.h +++ b/kernel/irq/internals.h @@ -129,6 +129,9 @@ static inline void chip_bus_sync_unlock(struct irq_desc *desc) #define IRQ_GET_DESC_CHECK_GLOBAL (_IRQ_DESC_CHECK) #define IRQ_GET_DESC_CHECK_PERCPU (_IRQ_DESC_CHECK | _IRQ_DESC_PERCPU) +#define for_each_desc_action(desc, act) \ + for (act = desc->act; act; act = act->next) + struct irq_desc * __irq_get_desc_lock(unsigned int irq, unsigned long *flags, bool bus, unsigned int check); diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c index 21cc7bf10c6b..e1718f44b0ee 100644 --- a/kernel/irq/manage.c +++ b/kernel/irq/manage.c @@ -144,13 +144,11 @@ int irq_can_set_affinity(unsigned int irq) */ void irq_set_thread_affinity(struct irq_desc *desc) { - struct irqaction *action = desc->action; + struct irqaction *action; - while (action) { + for_each_desc_action(desc, action) if (action->thread) set_bit(IRQTF_AFFINITY, &action->thread_flags); - action = action->next; - } } #ifdef CONFIG_GENERIC_PENDING_IRQ @@ -973,7 +971,7 @@ void irq_wake_thread(unsigned int irq, void *dev_id) return; raw_spin_lock_irqsave(&desc->lock, flags); - for (action = desc->action; action; action = action->next) { + for_each_desc_action(desc, action) { if (action->dev_id == dev_id) { if (action->thread) __irq_wake_thread(desc, action); diff --git a/kernel/irq/proc.c b/kernel/irq/proc.c index a50ddc9417ff..a41dea09c2f6 100644 --- a/kernel/irq/proc.c +++ b/kernel/irq/proc.c @@ -291,7 +291,7 @@ static int name_unique(unsigned int irq, struct irqaction *new_action) int ret = 1; raw_spin_lock_irqsave(&desc->lock, flags); - for (action = desc->action ; action; action = action->next) { + for_each_desc_action(desc, action) { if ((action != new_action) && action->name && !strcmp(new_action->name, action->name)) { ret = 0; diff --git a/kernel/irq/spurious.c b/kernel/irq/spurious.c index 32144175458d..3910b0abd355 100644 --- a/kernel/irq/spurious.c +++ b/kernel/irq/spurious.c @@ -211,14 +211,12 @@ static void __report_bad_irq(struct irq_desc *desc, irqreturn_t action_ret) * desc->lock here. See synchronize_irq(). */ raw_spin_lock_irqsave(&desc->lock, flags); - action = desc->action; - while (action) { + for_each_desc_action(desc, action) { printk(KERN_ERR "[<%p>] %pf", action->handler, action->handler); if (action->thread_fn) printk(KERN_CONT " threaded [<%p>] %pf", action->thread_fn, action->thread_fn); printk(KERN_CONT "\n"); - action = action->next; } raw_spin_unlock_irqrestore(&desc->lock, flags); } |