]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
genirq/chip: Rework irq_set_irq_type()
authorThomas Gleixner <tglx@linutronix.de>
Tue, 29 Apr 2025 06:55:20 +0000 (08:55 +0200)
committerThomas Gleixner <tglx@linutronix.de>
Wed, 7 May 2025 07:08:13 +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.355673840@linutronix.de
kernel/irq/chip.c

index 92bf81aeba224442e9946da4967b7a36cd1b628c..0904886fb2f7f3a1f80a7c413fa06edbb65700ec 100644 (file)
@@ -54,22 +54,15 @@ int irq_set_chip(unsigned int irq, const struct irq_chip *chip)
 EXPORT_SYMBOL(irq_set_chip);
 
 /**
- *     irq_set_irq_type - set the irq trigger type for an irq
- *     @irq:   irq number
- *     @type:  IRQ_TYPE_{LEVEL,EDGE}_* value - see include/linux/irq.h
+ * irq_set_irq_type - set the irq trigger type for an irq
+ * @irq:       irq number
+ * @type:      IRQ_TYPE_{LEVEL,EDGE}_* value - see include/linux/irq.h
  */
 int irq_set_irq_type(unsigned int irq, unsigned int type)
 {
-       unsigned long flags;
-       struct irq_desc *desc = irq_get_desc_buslock(irq, &flags, IRQ_GET_DESC_CHECK_GLOBAL);
-       int ret = 0;
-
-       if (!desc)
-               return -EINVAL;
-
-       ret = __irq_set_trigger(desc, type);
-       irq_put_desc_busunlock(desc, flags);
-       return ret;
+       scoped_irqdesc_get_and_buslock(irq, IRQ_GET_DESC_CHECK_GLOBAL)
+               return __irq_set_trigger(scoped_irqdesc, type);
+       return -EINVAL;
 }
 EXPORT_SYMBOL(irq_set_irq_type);