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

Fixup the kernel doc comment while at it.

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/20250429065421.532308759@linutronix.de
kernel/irq/chip.c

index 13d8c89cf564794536c4b1e518a1794d9abbd406..2041225332fd632e256407fd2970840a366ca251 100644 (file)
@@ -115,22 +115,19 @@ int irq_set_msi_desc(unsigned int irq, struct msi_desc *entry)
 }
 
 /**
- *     irq_set_chip_data - set irq chip data for an irq
- *     @irq:   Interrupt number
- *     @data:  Pointer to chip specific data
+ * irq_set_chip_data - set irq chip data for an irq
+ * @irq:       Interrupt number
+ * @data:      Pointer to chip specific data
  *
- *     Set the hardware irq chip data for an irq
+ * Set the hardware irq chip data for an irq
  */
 int irq_set_chip_data(unsigned int irq, void *data)
 {
-       unsigned long flags;
-       struct irq_desc *desc = irq_get_desc_lock(irq, &flags, 0);
-
-       if (!desc)
-               return -EINVAL;
-       desc->irq_data.chip_data = data;
-       irq_put_desc_unlock(desc, flags);
-       return 0;
+       scoped_irqdesc_get_and_lock(irq, 0) {
+               scoped_irqdesc->irq_data.chip_data = data;
+               return 0;
+       }
+       return -EINVAL;
 }
 EXPORT_SYMBOL(irq_set_chip_data);