genirq/manage: Rework irq_set_irq_wake()

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/87ldrhq0hc.ffs@tglx
This commit is contained in:
Thomas Gleixner 2025-04-30 14:48:15 +02:00
parent bddd10c554
commit 8589e325ba

View file

@ -846,20 +846,16 @@ static int set_irq_wake_real(unsigned int irq, unsigned int on)
*/ */
int irq_set_irq_wake(unsigned int irq, unsigned int on) int irq_set_irq_wake(unsigned int irq, unsigned int on)
{ {
unsigned long flags; scoped_irqdesc_get_and_lock(irq, IRQ_GET_DESC_CHECK_GLOBAL) {
struct irq_desc *desc = irq_get_desc_buslock(irq, &flags, IRQ_GET_DESC_CHECK_GLOBAL); struct irq_desc *desc = scoped_irqdesc;
int ret = 0; int ret = 0;
if (!desc) /* Don't use NMIs as wake up interrupts please */
if (irq_is_nmi(desc))
return -EINVAL; return -EINVAL;
/* Don't use NMIs as wake up interrupts please */ /*
if (irq_is_nmi(desc)) { * wakeup-capable irqs can be shared between drivers that
ret = -EINVAL;
goto out_unlock;
}
/* wakeup-capable irqs can be shared between drivers that
* don't need to have the same sleep mode behaviors. * don't need to have the same sleep mode behaviors.
*/ */
if (on) { if (on) {
@ -881,10 +877,9 @@ int irq_set_irq_wake(unsigned int irq, unsigned int on)
irqd_clear(&desc->irq_data, IRQD_WAKEUP_STATE); irqd_clear(&desc->irq_data, IRQD_WAKEUP_STATE);
} }
} }
out_unlock:
irq_put_desc_busunlock(desc, flags);
return ret; return ret;
}
return -EINVAL;
} }
EXPORT_SYMBOL(irq_set_irq_wake); EXPORT_SYMBOL(irq_set_irq_wake);