genirq/pm: Switch to lock guards
Convert all lock/unlock pairs to guards 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/20250429065420.251299112@linutronix.depull/1250/head
parent
e80618b27a
commit
19b4b14428
|
|
@ -46,8 +46,7 @@ void irq_pm_install_action(struct irq_desc *desc, struct irqaction *action)
|
|||
desc->cond_suspend_depth++;
|
||||
|
||||
WARN_ON_ONCE(desc->no_suspend_depth &&
|
||||
(desc->no_suspend_depth +
|
||||
desc->cond_suspend_depth) != desc->nr_actions);
|
||||
(desc->no_suspend_depth + desc->cond_suspend_depth) != desc->nr_actions);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -134,14 +133,12 @@ void suspend_device_irqs(void)
|
|||
int irq;
|
||||
|
||||
for_each_irq_desc(irq, desc) {
|
||||
unsigned long flags;
|
||||
bool sync;
|
||||
|
||||
if (irq_settings_is_nested_thread(desc))
|
||||
continue;
|
||||
raw_spin_lock_irqsave(&desc->lock, flags);
|
||||
sync = suspend_device_irq(desc);
|
||||
raw_spin_unlock_irqrestore(&desc->lock, flags);
|
||||
scoped_guard(raw_spinlock_irqsave, &desc->lock)
|
||||
sync = suspend_device_irq(desc);
|
||||
|
||||
if (sync)
|
||||
synchronize_irq(irq);
|
||||
|
|
@ -186,18 +183,15 @@ static void resume_irqs(bool want_early)
|
|||
int irq;
|
||||
|
||||
for_each_irq_desc(irq, desc) {
|
||||
unsigned long flags;
|
||||
bool is_early = desc->action &&
|
||||
desc->action->flags & IRQF_EARLY_RESUME;
|
||||
bool is_early = desc->action && desc->action->flags & IRQF_EARLY_RESUME;
|
||||
|
||||
if (!is_early && want_early)
|
||||
continue;
|
||||
if (irq_settings_is_nested_thread(desc))
|
||||
continue;
|
||||
|
||||
raw_spin_lock_irqsave(&desc->lock, flags);
|
||||
guard(raw_spinlock_irqsave)(&desc->lock);
|
||||
resume_irq(desc);
|
||||
raw_spin_unlock_irqrestore(&desc->lock, flags);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -207,22 +201,16 @@ static void resume_irqs(bool want_early)
|
|||
*/
|
||||
void rearm_wake_irq(unsigned int irq)
|
||||
{
|
||||
unsigned long flags;
|
||||
struct irq_desc *desc = irq_get_desc_buslock(irq, &flags, IRQ_GET_DESC_CHECK_GLOBAL);
|
||||
scoped_irqdesc_get_and_buslock(irq, IRQ_GET_DESC_CHECK_GLOBAL) {
|
||||
struct irq_desc *desc = scoped_irqdesc;
|
||||
|
||||
if (!desc)
|
||||
return;
|
||||
if (!(desc->istate & IRQS_SUSPENDED) || !irqd_is_wakeup_set(&desc->irq_data))
|
||||
return;
|
||||
|
||||
if (!(desc->istate & IRQS_SUSPENDED) ||
|
||||
!irqd_is_wakeup_set(&desc->irq_data))
|
||||
goto unlock;
|
||||
|
||||
desc->istate &= ~IRQS_SUSPENDED;
|
||||
irqd_set(&desc->irq_data, IRQD_WAKEUP_ARMED);
|
||||
__enable_irq(desc);
|
||||
|
||||
unlock:
|
||||
irq_put_desc_busunlock(desc, flags);
|
||||
desc->istate &= ~IRQS_SUSPENDED;
|
||||
irqd_set(&desc->irq_data, IRQD_WAKEUP_ARMED);
|
||||
__enable_irq(desc);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in New Issue