]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
genirq/manage: Rework irq_get_irqchip_state()
authorThomas Gleixner <tglx@linutronix.de>
Tue, 29 Apr 2025 06:55:52 +0000 (08:55 +0200)
committerThomas Gleixner <tglx@linutronix.de>
Wed, 7 May 2025 07:08:16 +0000 (09:08 +0200)
Use the new guards to get and lock the interrupt descriptor and tidy up the
code.

No functional change.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lore.kernel.org/all/20250429065422.612184618@linutronix.de
kernel/irq/manage.c

index fd5fcf3ea4ed0b84353f0f2fe5684daf54edaf27..1783c5294df587f2b13d6b4275d558a80878bd21 100644 (file)
@@ -2678,24 +2678,14 @@ static int __irq_get_irqchip_state(struct irq_data *data, enum irqchip_irq_state
  * This function should be called with preemption disabled if the interrupt
  * controller has per-cpu registers.
  */
-int irq_get_irqchip_state(unsigned int irq, enum irqchip_irq_state which,
-                         bool *state)
+int irq_get_irqchip_state(unsigned int irq, enum irqchip_irq_state which, bool *state)
 {
-       struct irq_desc *desc;
-       struct irq_data *data;
-       unsigned long flags;
-       int err = -EINVAL;
-
-       desc = irq_get_desc_buslock(irq, &flags, 0);
-       if (!desc)
-               return err;
-
-       data = irq_desc_get_irq_data(desc);
-
-       err = __irq_get_irqchip_state(data, which, state);
+       scoped_irqdesc_get_and_buslock(irq, 0) {
+               struct irq_data *data = irq_desc_get_irq_data(scoped_irqdesc);
 
-       irq_put_desc_busunlock(desc, flags);
-       return err;
+               return __irq_get_irqchip_state(data, which, state);
+       }
+       return -EINVAL;
 }
 EXPORT_SYMBOL_GPL(irq_get_irqchip_state);