@@ -46,8 +46,7 @@ void irq_pm_install_action(struct irq_desc *desc, struct irqaction *action)
4646 desc -> cond_suspend_depth ++ ;
4747
4848 WARN_ON_ONCE (desc -> no_suspend_depth &&
49- (desc -> no_suspend_depth +
50- desc -> cond_suspend_depth ) != desc -> nr_actions );
49+ (desc -> no_suspend_depth + desc -> cond_suspend_depth ) != desc -> nr_actions );
5150}
5251
5352/*
@@ -134,14 +133,12 @@ void suspend_device_irqs(void)
134133 int irq ;
135134
136135 for_each_irq_desc (irq , desc ) {
137- unsigned long flags ;
138136 bool sync ;
139137
140138 if (irq_settings_is_nested_thread (desc ))
141139 continue ;
142- raw_spin_lock_irqsave (& desc -> lock , flags );
143- sync = suspend_device_irq (desc );
144- raw_spin_unlock_irqrestore (& desc -> lock , flags );
140+ scoped_guard (raw_spinlock_irqsave , & desc -> lock )
141+ sync = suspend_device_irq (desc );
145142
146143 if (sync )
147144 synchronize_irq (irq );
@@ -186,18 +183,15 @@ static void resume_irqs(bool want_early)
186183 int irq ;
187184
188185 for_each_irq_desc (irq , desc ) {
189- unsigned long flags ;
190- bool is_early = desc -> action &&
191- desc -> action -> flags & IRQF_EARLY_RESUME ;
186+ bool is_early = desc -> action && desc -> action -> flags & IRQF_EARLY_RESUME ;
192187
193188 if (!is_early && want_early )
194189 continue ;
195190 if (irq_settings_is_nested_thread (desc ))
196191 continue ;
197192
198- raw_spin_lock_irqsave ( & desc -> lock , flags );
193+ guard ( raw_spinlock_irqsave )( & desc -> lock );
199194 resume_irq (desc );
200- raw_spin_unlock_irqrestore (& desc -> lock , flags );
201195 }
202196}
203197
@@ -207,22 +201,16 @@ static void resume_irqs(bool want_early)
207201 */
208202void rearm_wake_irq (unsigned int irq )
209203{
210- unsigned long flags ;
211- struct irq_desc * desc = irq_get_desc_buslock ( irq , & flags , IRQ_GET_DESC_CHECK_GLOBAL ) ;
204+ scoped_irqdesc_get_and_buslock ( irq , IRQ_GET_DESC_CHECK_GLOBAL ) {
205+ struct irq_desc * desc = scoped_irqdesc ;
212206
213- if (!desc )
214- return ;
215-
216- if (!(desc -> istate & IRQS_SUSPENDED ) ||
217- !irqd_is_wakeup_set (& desc -> irq_data ))
218- goto unlock ;
219-
220- desc -> istate &= ~IRQS_SUSPENDED ;
221- irqd_set (& desc -> irq_data , IRQD_WAKEUP_ARMED );
222- __enable_irq (desc );
207+ if (!(desc -> istate & IRQS_SUSPENDED ) || !irqd_is_wakeup_set (& desc -> irq_data ))
208+ return ;
223209
224- unlock :
225- irq_put_desc_busunlock (desc , flags );
210+ desc -> istate &= ~IRQS_SUSPENDED ;
211+ irqd_set (& desc -> irq_data , IRQD_WAKEUP_ARMED );
212+ __enable_irq (desc );
213+ }
226214}
227215
228216/**
0 commit comments