Skip to content

Commit 782249a

Browse files
committed
genirq/manage: Rework irq_get_irqchip_state()
Use the new guards to get and lock the interrupt descriptor and tidy up the code. No functional change. Signed-off-by: Thomas Gleixner <[email protected]> Acked-by: Peter Zijlstra (Intel) <[email protected]> Link: https://lore.kernel.org/all/[email protected]
1 parent 5fec6d5 commit 782249a

File tree

1 file changed

+6
-16
lines changed

1 file changed

+6
-16
lines changed

kernel/irq/manage.c

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2678,24 +2678,14 @@ static int __irq_get_irqchip_state(struct irq_data *data, enum irqchip_irq_state
26782678
* This function should be called with preemption disabled if the interrupt
26792679
* controller has per-cpu registers.
26802680
*/
2681-
int irq_get_irqchip_state(unsigned int irq, enum irqchip_irq_state which,
2682-
bool *state)
2681+
int irq_get_irqchip_state(unsigned int irq, enum irqchip_irq_state which, bool *state)
26832682
{
2684-
struct irq_desc *desc;
2685-
struct irq_data *data;
2686-
unsigned long flags;
2687-
int err = -EINVAL;
2688-
2689-
desc = irq_get_desc_buslock(irq, &flags, 0);
2690-
if (!desc)
2691-
return err;
2692-
2693-
data = irq_desc_get_irq_data(desc);
2694-
2695-
err = __irq_get_irqchip_state(data, which, state);
2683+
scoped_irqdesc_get_and_buslock(irq, 0) {
2684+
struct irq_data *data = irq_desc_get_irq_data(scoped_irqdesc);
26962685

2697-
irq_put_desc_busunlock(desc, flags);
2698-
return err;
2686+
return __irq_get_irqchip_state(data, which, state);
2687+
}
2688+
return -EINVAL;
26992689
}
27002690
EXPORT_SYMBOL_GPL(irq_get_irqchip_state);
27012691

0 commit comments

Comments
 (0)