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/[email protected] Signed-off-by: Sui Jingfeng <[email protected]> Signed-off-by: Bjorn Helgaas <[email protected]>
1 parent 60b4925 commit b421364

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

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)