Skip to content

Commit b421364

Browse files
Sui Jingfengbjorn-helgaas
authored andcommitted
PCI/VGA: Simplify vga_arbiter_notify_clients()
In vga_arbiter_notify_clients(), "new_state" was computed during every loop iteration even though it doesn't depend on anything that changes during the loop. Move the computation outside the loop. [bhelgaas: drop renames that obscure the purpose, commit log] Link: https://lore.kernel.org/r/20230808223412.1743176-6-sui.jingfeng@linux.dev Signed-off-by: Sui Jingfeng <suijingfeng@loongson.cn> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
1 parent 60b4925 commit b421364

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

drivers/pci/vgaarb.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1477,12 +1477,10 @@ static void vga_arbiter_notify_clients(void)
14771477
if (!vga_arbiter_used)
14781478
return;
14791479

1480+
new_state = (vga_count > 1) ? false : true;
1481+
14801482
spin_lock_irqsave(&vga_lock, flags);
14811483
list_for_each_entry(vgadev, &vga_list, list) {
1482-
if (vga_count > 1)
1483-
new_state = false;
1484-
else
1485-
new_state = true;
14861484
if (vgadev->set_decode) {
14871485
new_decodes = vgadev->set_decode(vgadev->pdev,
14881486
new_state);

0 commit comments

Comments
 (0)