Skip to content

Commit 4bcfdf7

Browse files
committed
x86/ioapic: Cleanup bracket usage
Add brackets around if/for constructs as required by coding style or remove pointless line breaks to make it true single line statements which do not require brackets. Signed-off-by: Thomas Gleixner <[email protected]> Tested-by: Qiuxu Zhuo <[email protected]> Tested-by: Breno Leitao <[email protected]> Link: https://lore.kernel.org/all/[email protected]
1 parent 75d4494 commit 4bcfdf7

File tree

1 file changed

+18
-16
lines changed

1 file changed

+18
-16
lines changed

arch/x86/kernel/apic/io_apic.c

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -362,12 +362,13 @@ static void __remove_pin_from_irq(struct mp_chip_data *data, int apic, int pin)
362362
{
363363
struct irq_pin_list *tmp, *entry;
364364

365-
list_for_each_entry_safe(entry, tmp, &data->irq_2_pin, list)
365+
list_for_each_entry_safe(entry, tmp, &data->irq_2_pin, list) {
366366
if (entry->apic == apic && entry->pin == pin) {
367367
list_del(&entry->list);
368368
kfree(entry);
369369
return;
370370
}
371+
}
371372
}
372373

373374
static void io_apic_modify_irq(struct mp_chip_data *data, bool masked,
@@ -562,8 +563,7 @@ int save_ioapic_entries(void)
562563
}
563564

564565
for_each_pin(apic, pin)
565-
ioapics[apic].saved_registers[pin] =
566-
ioapic_read_entry(apic, pin);
566+
ioapics[apic].saved_registers[pin] = ioapic_read_entry(apic, pin);
567567
}
568568

569569
return err;
@@ -604,8 +604,7 @@ int restore_ioapic_entries(void)
604604
continue;
605605

606606
for_each_pin(apic, pin)
607-
ioapic_write_entry(apic, pin,
608-
ioapics[apic].saved_registers[pin]);
607+
ioapic_write_entry(apic, pin, ioapics[apic].saved_registers[pin]);
609608
}
610609
return 0;
611610
}
@@ -617,12 +616,13 @@ static int find_irq_entry(int ioapic_idx, int pin, int type)
617616
{
618617
int i;
619618

620-
for (i = 0; i < mp_irq_entries; i++)
619+
for (i = 0; i < mp_irq_entries; i++) {
621620
if (mp_irqs[i].irqtype == type &&
622621
(mp_irqs[i].dstapic == mpc_ioapic_id(ioapic_idx) ||
623622
mp_irqs[i].dstapic == MP_APIC_ALL) &&
624623
mp_irqs[i].dstirq == pin)
625624
return i;
625+
}
626626

627627
return -1;
628628
}
@@ -662,9 +662,10 @@ static int __init find_isa_irq_apic(int irq, int type)
662662
if (i < mp_irq_entries) {
663663
int ioapic_idx;
664664

665-
for_each_ioapic(ioapic_idx)
665+
for_each_ioapic(ioapic_idx) {
666666
if (mpc_ioapic_id(ioapic_idx) == mp_irqs[i].dstapic)
667667
return ioapic_idx;
668+
}
668669
}
669670

670671
return -1;
@@ -1424,11 +1425,12 @@ static void __init setup_ioapic_ids_from_mpc_nocheck(void)
14241425
* We need to adjust the IRQ routing table if the ID
14251426
* changed.
14261427
*/
1427-
if (old_id != mpc_ioapic_id(ioapic_idx))
1428-
for (i = 0; i < mp_irq_entries; i++)
1428+
if (old_id != mpc_ioapic_id(ioapic_idx)) {
1429+
for (i = 0; i < mp_irq_entries; i++) {
14291430
if (mp_irqs[i].dstapic == old_id)
1430-
mp_irqs[i].dstapic
1431-
= mpc_ioapic_id(ioapic_idx);
1431+
mp_irqs[i].dstapic = mpc_ioapic_id(ioapic_idx);
1432+
}
1433+
}
14321434

14331435
/*
14341436
* Update the ID register according to the right value from
@@ -2666,12 +2668,10 @@ static int bad_ioapic_register(int idx)
26662668

26672669
static int find_free_ioapic_entry(void)
26682670
{
2669-
int idx;
2670-
2671-
for (idx = 0; idx < MAX_IO_APICS; idx++)
2671+
for (int idx = 0; idx < MAX_IO_APICS; idx++) {
26722672
if (ioapics[idx].nr_registers == 0)
26732673
return idx;
2674-
2674+
}
26752675
return MAX_IO_APICS;
26762676
}
26772677

@@ -2780,11 +2780,13 @@ int mp_unregister_ioapic(u32 gsi_base)
27802780
int ioapic, pin;
27812781
int found = 0;
27822782

2783-
for_each_ioapic(ioapic)
2783+
for_each_ioapic(ioapic) {
27842784
if (ioapics[ioapic].gsi_config.gsi_base == gsi_base) {
27852785
found = 1;
27862786
break;
27872787
}
2788+
}
2789+
27882790
if (!found) {
27892791
pr_warn("can't find IOAPIC for GSI %d\n", gsi_base);
27902792
return -ENODEV;

0 commit comments

Comments
 (0)