Skip to content

Commit e7c6542

Browse files
committed
genirq/chip: Use lock guards where applicable
Convert all lock/unlock pairs to guards and tidy up the code. No functional change. Signed-off-by: Thomas Gleixner <[email protected]> Acked-by: Peter Zijlstra (Intel) <[email protected]> Link: https://lore.kernel.org/all/[email protected]
1 parent f71d7c4 commit e7c6542

File tree

1 file changed

+8
-16
lines changed

1 file changed

+8
-16
lines changed

kernel/irq/chip.c

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1049,25 +1049,21 @@ EXPORT_SYMBOL_GPL(irq_modify_status);
10491049
*/
10501050
void irq_cpu_online(void)
10511051
{
1052-
struct irq_desc *desc;
1053-
struct irq_chip *chip;
1054-
unsigned long flags;
10551052
unsigned int irq;
10561053

10571054
for_each_active_irq(irq) {
1058-
desc = irq_to_desc(irq);
1055+
struct irq_desc *desc = irq_to_desc(irq);
1056+
struct irq_chip *chip;
1057+
10591058
if (!desc)
10601059
continue;
10611060

1062-
raw_spin_lock_irqsave(&desc->lock, flags);
1063-
1061+
guard(raw_spinlock_irqsave)(&desc->lock);
10641062
chip = irq_data_get_irq_chip(&desc->irq_data);
10651063
if (chip && chip->irq_cpu_online &&
10661064
(!(chip->flags & IRQCHIP_ONOFFLINE_ENABLED) ||
10671065
!irqd_irq_disabled(&desc->irq_data)))
10681066
chip->irq_cpu_online(&desc->irq_data);
1069-
1070-
raw_spin_unlock_irqrestore(&desc->lock, flags);
10711067
}
10721068
}
10731069

@@ -1079,25 +1075,21 @@ void irq_cpu_online(void)
10791075
*/
10801076
void irq_cpu_offline(void)
10811077
{
1082-
struct irq_desc *desc;
1083-
struct irq_chip *chip;
1084-
unsigned long flags;
10851078
unsigned int irq;
10861079

10871080
for_each_active_irq(irq) {
1088-
desc = irq_to_desc(irq);
1081+
struct irq_desc *desc = irq_to_desc(irq);
1082+
struct irq_chip *chip;
1083+
10891084
if (!desc)
10901085
continue;
10911086

1092-
raw_spin_lock_irqsave(&desc->lock, flags);
1093-
1087+
guard(raw_spinlock_irqsave)(&desc->lock);
10941088
chip = irq_data_get_irq_chip(&desc->irq_data);
10951089
if (chip && chip->irq_cpu_offline &&
10961090
(!(chip->flags & IRQCHIP_ONOFFLINE_ENABLED) ||
10971091
!irqd_irq_disabled(&desc->irq_data)))
10981092
chip->irq_cpu_offline(&desc->irq_data);
1099-
1100-
raw_spin_unlock_irqrestore(&desc->lock, flags);
11011093
}
11021094
}
11031095
#endif

0 commit comments

Comments
 (0)