[irqchip: irq/irqchip-next] genirq: Replace irqaction:irq with a pointer to the irqdesc

From: irqchip-bot for Marc Zyngier
Date: Sun Jun 06 2021 - 08:45:23 EST


The following commit has been merged into the irq/irqchip-next branch of irqchip:

Commit-ID: bb33916b527fbdbe23c93c2b86375590c2fc92e2
Gitweb: https://git.kernel.org/pub/scm/linux/kernel/git/maz/arm-platforms/bb33916b527fbdbe23c93c2b86375590c2fc92e2
Author: Marc Zyngier <maz@xxxxxxxxxx>
AuthorDate: Tue, 20 Apr 2021 09:19:54 +01:00
Committer: Marc Zyngier <maz@xxxxxxxxxx>
CommitterDate: Wed, 02 Jun 2021 14:34:46 +01:00

genirq: Replace irqaction:irq with a pointer to the irqdesc

It is a bit odd that irqaction contains the irq number instead
of a back-pointer to the desc it is attached to, specially considering
it is an internal structure.

Replace the irq field with the backpointer.

Signed-off-by: Marc Zyngier <maz@xxxxxxxxxx>
---
include/linux/interrupt.h | 2 +-
kernel/irq/chip.c | 2 +-
kernel/irq/manage.c | 15 +++++++--------
3 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h
index 4777850..7191950 100644
--- a/include/linux/interrupt.h
+++ b/include/linux/interrupt.h
@@ -119,7 +119,7 @@ struct irqaction {
irq_handler_t thread_fn;
struct task_struct *thread;
struct irqaction *secondary;
- unsigned int irq;
+ struct irq_desc *desc;
unsigned int flags;
unsigned long thread_flags;
unsigned long thread_mask;
diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c
index 8cc8e57..764e046 100644
--- a/kernel/irq/chip.c
+++ b/kernel/irq/chip.c
@@ -479,7 +479,7 @@ void handle_nested_irq(unsigned int irq)

action_ret = IRQ_NONE;
for_each_action_of_desc(desc, action)
- action_ret |= action->thread_fn(action->irq, action->dev_id);
+ action_ret |= action->thread_fn(irq_desc_get_irq(desc), action->dev_id);

if (!noirqdebug)
note_interrupt(desc, action_ret);
diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
index 4c14356..1e519e2 100644
--- a/kernel/irq/manage.c
+++ b/kernel/irq/manage.c
@@ -1144,7 +1144,7 @@ irq_forced_thread_fn(struct irq_desc *desc, struct irqaction *action)
local_bh_disable();
if (!IS_ENABLED(CONFIG_PREEMPT_RT))
local_irq_disable();
- ret = action->thread_fn(action->irq, action->dev_id);
+ ret = action->thread_fn(irq_desc_get_irq(desc), action->dev_id);
if (ret == IRQ_HANDLED)
atomic_inc(&desc->threads_handled);

@@ -1165,7 +1165,7 @@ static irqreturn_t irq_thread_fn(struct irq_desc *desc,
{
irqreturn_t ret;

- ret = action->thread_fn(action->irq, action->dev_id);
+ ret = action->thread_fn(irq_desc_get_irq(desc), action->dev_id);
if (ret == IRQ_HANDLED)
atomic_inc(&desc->threads_handled);

@@ -1189,12 +1189,11 @@ static void irq_thread_dtor(struct callback_head *unused)
return;

action = kthread_data(tsk);
+ desc = action->desc;

pr_err("exiting task \"%s\" (%d) is an active IRQ thread (irq %d)\n",
- tsk->comm, tsk->pid, action->irq);
+ tsk->comm, tsk->pid, irq_desc_get_irq(desc));

-
- desc = irq_to_desc(action->irq);
/*
* If IRQTF_RUNTHREAD is set, we need to decrement
* desc->threads_active and wake possible waiters.
@@ -1225,7 +1224,7 @@ static int irq_thread(void *data)
{
struct callback_head on_exit_work;
struct irqaction *action = data;
- struct irq_desc *desc = irq_to_desc(action->irq);
+ struct irq_desc *desc = action->desc;
irqreturn_t (*handler_fn)(struct irq_desc *desc,
struct irqaction *action);

@@ -1318,7 +1317,7 @@ static int irq_setup_forced_threading(struct irqaction *new)
new->secondary->handler = irq_forced_secondary_handler;
new->secondary->thread_fn = new->thread_fn;
new->secondary->dev_id = new->dev_id;
- new->secondary->irq = new->irq;
+ new->secondary->desc = new->desc;
new->secondary->name = new->name;
}
/* Deal with the primary handler */
@@ -1444,7 +1443,7 @@ __setup_irq(unsigned int irq, struct irq_desc *desc, struct irqaction *new)
if (!try_module_get(desc->owner))
return -ENODEV;

- new->irq = irq;
+ new->desc = desc;

/*
* If the trigger type is not specified by the caller,