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>
This commit is contained in:
parent
fbf198030e
commit
f944b5a7af
5 changed files with 10 additions and 13 deletions
|
@ -136,10 +136,9 @@ irqreturn_t handle_irq_event_percpu(struct irq_desc *desc)
|
||||||
{
|
{
|
||||||
irqreturn_t retval = IRQ_NONE;
|
irqreturn_t retval = IRQ_NONE;
|
||||||
unsigned int flags = 0, irq = desc->irq_data.irq;
|
unsigned int flags = 0, irq = desc->irq_data.irq;
|
||||||
struct irqaction *action = desc->action;
|
struct irqaction *action;
|
||||||
|
|
||||||
/* action might have become NULL since we dropped the lock */
|
for_each_action_of_desc(desc, action) {
|
||||||
while (action) {
|
|
||||||
irqreturn_t res;
|
irqreturn_t res;
|
||||||
|
|
||||||
trace_irq_handler_entry(irq, action);
|
trace_irq_handler_entry(irq, action);
|
||||||
|
@ -173,7 +172,6 @@ irqreturn_t handle_irq_event_percpu(struct irq_desc *desc)
|
||||||
}
|
}
|
||||||
|
|
||||||
retval |= res;
|
retval |= res;
|
||||||
action = action->next;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
add_interrupt_randomness(irq, flags);
|
add_interrupt_randomness(irq, flags);
|
||||||
|
|
|
@ -131,6 +131,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_GLOBAL (_IRQ_DESC_CHECK)
|
||||||
#define IRQ_GET_DESC_CHECK_PERCPU (_IRQ_DESC_CHECK | _IRQ_DESC_PERCPU)
|
#define IRQ_GET_DESC_CHECK_PERCPU (_IRQ_DESC_CHECK | _IRQ_DESC_PERCPU)
|
||||||
|
|
||||||
|
#define for_each_action_of_desc(desc, act) \
|
||||||
|
for (act = desc->act; act; act = act->next)
|
||||||
|
|
||||||
struct irq_desc *
|
struct irq_desc *
|
||||||
__irq_get_desc_lock(unsigned int irq, unsigned long *flags, bool bus,
|
__irq_get_desc_lock(unsigned int irq, unsigned long *flags, bool bus,
|
||||||
unsigned int check);
|
unsigned int check);
|
||||||
|
|
|
@ -144,13 +144,11 @@ int irq_can_set_affinity(unsigned int irq)
|
||||||
*/
|
*/
|
||||||
void irq_set_thread_affinity(struct irq_desc *desc)
|
void irq_set_thread_affinity(struct irq_desc *desc)
|
||||||
{
|
{
|
||||||
struct irqaction *action = desc->action;
|
struct irqaction *action;
|
||||||
|
|
||||||
while (action) {
|
for_each_action_of_desc(desc, action)
|
||||||
if (action->thread)
|
if (action->thread)
|
||||||
set_bit(IRQTF_AFFINITY, &action->thread_flags);
|
set_bit(IRQTF_AFFINITY, &action->thread_flags);
|
||||||
action = action->next;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_GENERIC_PENDING_IRQ
|
#ifdef CONFIG_GENERIC_PENDING_IRQ
|
||||||
|
@ -994,7 +992,7 @@ void irq_wake_thread(unsigned int irq, void *dev_id)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
raw_spin_lock_irqsave(&desc->lock, flags);
|
raw_spin_lock_irqsave(&desc->lock, flags);
|
||||||
for (action = desc->action; action; action = action->next) {
|
for_each_action_of_desc(desc, action) {
|
||||||
if (action->dev_id == dev_id) {
|
if (action->dev_id == dev_id) {
|
||||||
if (action->thread)
|
if (action->thread)
|
||||||
__irq_wake_thread(desc, action);
|
__irq_wake_thread(desc, action);
|
||||||
|
|
|
@ -291,7 +291,7 @@ static int name_unique(unsigned int irq, struct irqaction *new_action)
|
||||||
int ret = 1;
|
int ret = 1;
|
||||||
|
|
||||||
raw_spin_lock_irqsave(&desc->lock, flags);
|
raw_spin_lock_irqsave(&desc->lock, flags);
|
||||||
for (action = desc->action ; action; action = action->next) {
|
for_each_action_of_desc(desc, action) {
|
||||||
if ((action != new_action) && action->name &&
|
if ((action != new_action) && action->name &&
|
||||||
!strcmp(new_action->name, action->name)) {
|
!strcmp(new_action->name, action->name)) {
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
|
|
@ -211,14 +211,12 @@ static void __report_bad_irq(struct irq_desc *desc, irqreturn_t action_ret)
|
||||||
* desc->lock here. See synchronize_irq().
|
* desc->lock here. See synchronize_irq().
|
||||||
*/
|
*/
|
||||||
raw_spin_lock_irqsave(&desc->lock, flags);
|
raw_spin_lock_irqsave(&desc->lock, flags);
|
||||||
action = desc->action;
|
for_each_action_of_desc(desc, action) {
|
||||||
while (action) {
|
|
||||||
printk(KERN_ERR "[<%p>] %pf", action->handler, action->handler);
|
printk(KERN_ERR "[<%p>] %pf", action->handler, action->handler);
|
||||||
if (action->thread_fn)
|
if (action->thread_fn)
|
||||||
printk(KERN_CONT " threaded [<%p>] %pf",
|
printk(KERN_CONT " threaded [<%p>] %pf",
|
||||||
action->thread_fn, action->thread_fn);
|
action->thread_fn, action->thread_fn);
|
||||||
printk(KERN_CONT "\n");
|
printk(KERN_CONT "\n");
|
||||||
action = action->next;
|
|
||||||
}
|
}
|
||||||
raw_spin_unlock_irqrestore(&desc->lock, flags);
|
raw_spin_unlock_irqrestore(&desc->lock, flags);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue