vt8237r: Simplify bootblock init to work around nested if() romcc problem
authorPeter Stuge <peter@stuge.se>
Sat, 4 Jun 2011 15:40:12 +0000 (15:40 +0000)
committerPeter Stuge <peter@stuge.se>
Sat, 4 Jun 2011 15:40:12 +0000 (15:40 +0000)
During the hackathon in Prague we discovered that romcc has a problem
compiling the previous nested if() statements correctly. This patch
makes the code a little simpler, and indeed works around the romcc issue.

Signed-off-by: Peter Stuge <peter@stuge.se>
Acked-by: Peter Stuge <peter@stuge.se>
git-svn-id: svn://svn.coreboot.org/coreboot/trunk@6620 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1

src/southbridge/via/vt8237r/bootblock.c

index b231f844c9e3a947fb4ed4166c0fa57fc3a11af9..8df37aad7ca7bb80fb9bb14fd1ababfb71e78923 100644 (file)
@@ -33,20 +33,23 @@ static void bootblock_southbridge_init(void)
        dev = pci_locate_device_on_bus(PCI_ID(PCI_VENDOR_ID_VIA,
                    PCI_DEVICE_ID_VIA_VT8237R_LPC), 0);
 
-       if (dev == PCI_DEV_INVALID) {
-               /* Power management controller */
-               dev = pci_locate_device_on_bus(PCI_ID(PCI_VENDOR_ID_VIA,
-                       PCI_DEVICE_ID_VIA_VT8237S_LPC), 0);
+       if (dev != PCI_DEV_INVALID)
+               goto found;
 
-               if (dev == PCI_DEV_INVALID) {
-                       /* Power management controller */
-                       dev = pci_locate_device_on_bus(PCI_ID(PCI_VENDOR_ID_VIA,
-                               PCI_DEVICE_ID_VIA_VT8237A_LPC), 0);
+       /* Power management controller */
+       dev = pci_locate_device_on_bus(PCI_ID(PCI_VENDOR_ID_VIA,
+               PCI_DEVICE_ID_VIA_VT8237S_LPC), 0);
+
+       if (dev != PCI_DEV_INVALID)
+               goto found;
+
+       /* Power management controller */
+       dev = pci_locate_device_on_bus(PCI_ID(PCI_VENDOR_ID_VIA,
+               PCI_DEVICE_ID_VIA_VT8237A_LPC), 0);
 
-                       if (dev == PCI_DEV_INVALID)
-                               return;
-               }
-       }
+       if (dev == PCI_DEV_INVALID)
+               return;
 
+found:
        pci_write_config8(dev, 0x41, 0x7f);
 }