diff options
author | Daniel Lezcano <daniel.lezcano@linaro.org> | 2016-01-14 04:54:13 -0500 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2016-02-14 18:07:34 -0500 |
commit | f944b5a7aff05a244a6c8cac297819af09a199e4 (patch) | |
tree | 4f0af25234339850aea59022f6a63fbd19a9600c | |
parent | fbf198030e0b027538c290300cfaf9e2efdce122 (diff) |
genirq: Use a common macro to go through the actions 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 consistent code,
provide a macro similar to for_each_irq_desc in order to have the same loop to
go through the actions list and use it in the code.
[ tglx: Renamed the macro ]
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Link: http://lkml.kernel.org/r/1452765253-31148-1-git-send-email-daniel.lezcano@linaro.org
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
-rw-r--r-- | kernel/irq/handle.c | 6 | ||||
-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, 10 insertions, 13 deletions
diff --git a/kernel/irq/handle.c b/kernel/irq/handle.c index 57bff7857e87..a15b5485b446 100644 --- a/kernel/irq/handle.c +++ b/kernel/irq/handle.c | |||
@@ -136,10 +136,9 @@ irqreturn_t handle_irq_event_percpu(struct irq_desc *desc) | |||
136 | { | 136 | { |
137 | irqreturn_t retval = IRQ_NONE; | 137 | irqreturn_t retval = IRQ_NONE; |
138 | unsigned int flags = 0, irq = desc->irq_data.irq; | 138 | unsigned int flags = 0, irq = desc->irq_data.irq; |
139 | struct irqaction *action = desc->action; | 139 | struct irqaction *action; |
140 | 140 | ||
141 | /* action might have become NULL since we dropped the lock */ | 141 | for_each_action_of_desc(desc, action) { |
142 | while (action) { | ||
143 | irqreturn_t res; | 142 | irqreturn_t res; |
144 | 143 | ||
145 | trace_irq_handler_entry(irq, action); | 144 | trace_irq_handler_entry(irq, action); |
@@ -173,7 +172,6 @@ irqreturn_t handle_irq_event_percpu(struct irq_desc *desc) | |||
173 | } | 172 | } |
174 | 173 | ||
175 | retval |= res; | 174 | retval |= res; |
176 | action = action->next; | ||
177 | } | 175 | } |
178 | 176 | ||
179 | add_interrupt_randomness(irq, flags); | 177 | add_interrupt_randomness(irq, flags); |
diff --git a/kernel/irq/internals.h b/kernel/irq/internals.h index fcab63c66905..eab521fc547c 100644 --- a/kernel/irq/internals.h +++ b/kernel/irq/internals.h | |||
@@ -131,6 +131,9 @@ static inline void chip_bus_sync_unlock(struct irq_desc *desc) | |||
131 | #define IRQ_GET_DESC_CHECK_GLOBAL (_IRQ_DESC_CHECK) | 131 | #define IRQ_GET_DESC_CHECK_GLOBAL (_IRQ_DESC_CHECK) |
132 | #define IRQ_GET_DESC_CHECK_PERCPU (_IRQ_DESC_CHECK | _IRQ_DESC_PERCPU) | 132 | #define IRQ_GET_DESC_CHECK_PERCPU (_IRQ_DESC_CHECK | _IRQ_DESC_PERCPU) |
133 | 133 | ||
134 | #define for_each_action_of_desc(desc, act) \ | ||
135 | for (act = desc->act; act; act = act->next) | ||
136 | |||
134 | struct irq_desc * | 137 | struct irq_desc * |
135 | __irq_get_desc_lock(unsigned int irq, unsigned long *flags, bool bus, | 138 | __irq_get_desc_lock(unsigned int irq, unsigned long *flags, bool bus, |
136 | unsigned int check); | 139 | unsigned int check); |
diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c index 841187239adc..3ddd2297ee95 100644 --- a/kernel/irq/manage.c +++ b/kernel/irq/manage.c | |||
@@ -144,13 +144,11 @@ int irq_can_set_affinity(unsigned int irq) | |||
144 | */ | 144 | */ |
145 | void irq_set_thread_affinity(struct irq_desc *desc) | 145 | void irq_set_thread_affinity(struct irq_desc *desc) |
146 | { | 146 | { |
147 | struct irqaction *action = desc->action; | 147 | struct irqaction *action; |
148 | 148 | ||
149 | while (action) { | 149 | for_each_action_of_desc(desc, action) |
150 | if (action->thread) | 150 | if (action->thread) |
151 | set_bit(IRQTF_AFFINITY, &action->thread_flags); | 151 | set_bit(IRQTF_AFFINITY, &action->thread_flags); |
152 | action = action->next; | ||
153 | } | ||
154 | } | 152 | } |
155 | 153 | ||
156 | #ifdef CONFIG_GENERIC_PENDING_IRQ | 154 | #ifdef CONFIG_GENERIC_PENDING_IRQ |
@@ -994,7 +992,7 @@ void irq_wake_thread(unsigned int irq, void *dev_id) | |||
994 | return; | 992 | return; |
995 | 993 | ||
996 | raw_spin_lock_irqsave(&desc->lock, flags); | 994 | raw_spin_lock_irqsave(&desc->lock, flags); |
997 | for (action = desc->action; action; action = action->next) { | 995 | for_each_action_of_desc(desc, action) { |
998 | if (action->dev_id == dev_id) { | 996 | if (action->dev_id == dev_id) { |
999 | if (action->thread) | 997 | if (action->thread) |
1000 | __irq_wake_thread(desc, action); | 998 | __irq_wake_thread(desc, action); |
diff --git a/kernel/irq/proc.c b/kernel/irq/proc.c index a2c02fd5d6d0..4e1b94726818 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) | |||
291 | int ret = 1; | 291 | int ret = 1; |
292 | 292 | ||
293 | raw_spin_lock_irqsave(&desc->lock, flags); | 293 | raw_spin_lock_irqsave(&desc->lock, flags); |
294 | for (action = desc->action ; action; action = action->next) { | 294 | for_each_action_of_desc(desc, action) { |
295 | if ((action != new_action) && action->name && | 295 | if ((action != new_action) && action->name && |
296 | !strcmp(new_action->name, action->name)) { | 296 | !strcmp(new_action->name, action->name)) { |
297 | ret = 0; | 297 | ret = 0; |
diff --git a/kernel/irq/spurious.c b/kernel/irq/spurious.c index 32144175458d..5707f97a3e6a 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) | |||
211 | * desc->lock here. See synchronize_irq(). | 211 | * desc->lock here. See synchronize_irq(). |
212 | */ | 212 | */ |
213 | raw_spin_lock_irqsave(&desc->lock, flags); | 213 | raw_spin_lock_irqsave(&desc->lock, flags); |
214 | action = desc->action; | 214 | for_each_action_of_desc(desc, action) { |
215 | while (action) { | ||
216 | printk(KERN_ERR "[<%p>] %pf", action->handler, action->handler); | 215 | printk(KERN_ERR "[<%p>] %pf", action->handler, action->handler); |
217 | if (action->thread_fn) | 216 | if (action->thread_fn) |
218 | printk(KERN_CONT " threaded [<%p>] %pf", | 217 | printk(KERN_CONT " threaded [<%p>] %pf", |
219 | action->thread_fn, action->thread_fn); | 218 | action->thread_fn, action->thread_fn); |
220 | printk(KERN_CONT "\n"); | 219 | printk(KERN_CONT "\n"); |
221 | action = action->next; | ||
222 | } | 220 | } |
223 | raw_spin_unlock_irqrestore(&desc->lock, flags); | 221 | raw_spin_unlock_irqrestore(&desc->lock, flags); |
224 | } | 222 | } |