]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
genirq/manage: Rework enable_percpu_irq()
authorThomas Gleixner <tglx@linutronix.de>
Tue, 29 Apr 2025 06:55:44 +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.315844964@linutronix.de
kernel/irq/manage.c

index a08bbada83eac8192b6729f4f306a0e2d81e7ece..e27fa4e2fd1e00b07a752173e5f7503129c3ffd3 100644 (file)
@@ -2286,35 +2286,25 @@ err_out:
 
 void enable_percpu_irq(unsigned int irq, unsigned int type)
 {
-       unsigned int cpu = smp_processor_id();
-       unsigned long flags;
-       struct irq_desc *desc = irq_get_desc_lock(irq, &flags, IRQ_GET_DESC_CHECK_PERCPU);
-
-       if (!desc)
-               return;
-
-       /*
-        * If the trigger type is not specified by the caller, then
-        * use the default for this interrupt.
-        */
-       type &= IRQ_TYPE_SENSE_MASK;
-       if (type == IRQ_TYPE_NONE)
-               type = irqd_get_trigger_type(&desc->irq_data);
-
-       if (type != IRQ_TYPE_NONE) {
-               int ret;
-
-               ret = __irq_set_trigger(desc, type);
+       scoped_irqdesc_get_and_lock(irq, IRQ_GET_DESC_CHECK_PERCPU) {
+               struct irq_desc *desc = scoped_irqdesc;
 
-               if (ret) {
-                       WARN(1, "failed to set type for IRQ%d\n", irq);
-                       goto out;
+               /*
+                * If the trigger type is not specified by the caller, then
+                * use the default for this interrupt.
+                */
+               type &= IRQ_TYPE_SENSE_MASK;
+               if (type == IRQ_TYPE_NONE)
+                       type = irqd_get_trigger_type(&desc->irq_data);
+
+               if (type != IRQ_TYPE_NONE) {
+                       if (__irq_set_trigger(desc, type)) {
+                               WARN(1, "failed to set type for IRQ%d\n", irq);
+                               return;
+                       }
                }
+               irq_percpu_enable(desc, smp_processor_id());
        }
-
-       irq_percpu_enable(desc, cpu);
-out:
-       irq_put_desc_unlock(desc, flags);
 }
 EXPORT_SYMBOL_GPL(enable_percpu_irq);