staging: xgifb: vb_setmode: reduce if nesting in XGI_SetLockRegs()
authorAaro Koskinen <aaro.koskinen@iki.fi>
Sun, 27 Nov 2011 21:03:19 +0000 (23:03 +0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Sun, 27 Nov 2011 21:20:13 +0000 (06:20 +0900)
Eliminate unnecessary nesting levels by rearranging code and conditions.
The resulting code should be still identical.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/staging/xgifb/vb_setmode.c

index 0b780024292811b6976d2c5f440f487acd290e44..632ebfa7c408f5c88fee61a6824baaf36b184504 100644 (file)
@@ -4547,36 +4547,23 @@ static void XGI_SetLockRegs(unsigned short ModeNo, unsigned short ModeIdIndex,
                                                temp -= 6;
                                }
                        }
-               } else {
-                       if (!(modeflag & HalfDCLK)) {
-                               temp -= 4;
-                               if (pVBInfo->LCDResInfo != Panel1280x960) {
-                                       if (pVBInfo->VGAHDE >= 800) {
-                                               temp -= 7;
-                                               if (pVBInfo->ModeType ==
-                                                       ModeEGA) {
-                                                       if (pVBInfo->VGAVDE ==
-                                                           1024) {
-                                                               temp += 15;
-                                                               if (pVBInfo->LCDResInfo != Panel1280x1024) {
-                                                                       temp +=
-                                                                           7;
-                                                               }
-                                                       }
-                                               }
-
-                                               if (pVBInfo->VGAHDE >= 1280) {
-                                                       if (pVBInfo->LCDResInfo
-                                                                       != Panel1280x960) {
-                                                               if (pVBInfo->LCDInfo
-                                                                               & LCDNonExpanding) {
-                                                                       temp
-                                                                                       += 28;
-                                                               }
-                                                       }
-                                               }
-                                       }
+               } else if (!(modeflag & HalfDCLK)) {
+                       temp -= 4;
+                       if (pVBInfo->LCDResInfo != Panel1280x960 &&
+                           pVBInfo->VGAHDE >= 800) {
+                               temp -= 7;
+                               if (pVBInfo->ModeType == ModeEGA &&
+                                   pVBInfo->VGAVDE == 1024) {
+                                       temp += 15;
+                                       if (pVBInfo->LCDResInfo !=
+                                               Panel1280x1024)
+                                               temp += 7;
                                }
+
+                               if (pVBInfo->VGAHDE >= 1280 &&
+                                   pVBInfo->LCDResInfo != Panel1280x960 &&
+                                   (pVBInfo->LCDInfo & LCDNonExpanding))
+                                       temp += 28;
                        }
                }
        }