staging/xgifb: Simplify XGISetModeNew
authorPeter Huewe <peterhuewe@gmx.de>
Sun, 3 Feb 2013 21:54:39 +0000 (22:54 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 4 Feb 2013 18:46:28 +0000 (10:46 -0800)
This patch simplifies the code of XGISetModeNew by reordering the
if/else if/case conditions when both branches are doing exactly the
same.

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/xgifb/vb_setmode.c

index c5faa8984f1ba04f2644de02ee617c5ed4cc6b5b..f44a254414843a44a33adea20378c85115ca2665 100644 (file)
@@ -5907,7 +5907,8 @@ unsigned char XGISetModeNew(struct xgifb_video_info *xgifb_info,
                XGI_GetLCDInfo(ModeNo, ModeIdIndex, pVBInfo);
                XGI_DisableBridge(xgifb_info, HwDeviceExtension, pVBInfo);
 
-               if (pVBInfo->VBInfo & (SetSimuScanMode | XGI_SetCRT2ToLCDA)) {
+               if (pVBInfo->VBInfo & (SetSimuScanMode | XGI_SetCRT2ToLCDA) ||
+                       (!(pVBInfo->VBInfo & SwitchCRT2))) {
                        XGI_SetCRT1Group(xgifb_info, HwDeviceExtension, ModeNo,
                                        ModeIdIndex, pVBInfo);
 
@@ -5915,24 +5916,11 @@ unsigned char XGISetModeNew(struct xgifb_video_info *xgifb_info,
                                XGI_SetLCDAGroup(ModeNo, ModeIdIndex,
                                                HwDeviceExtension, pVBInfo);
                        }
-               } else if (!(pVBInfo->VBInfo & SwitchCRT2)) {
-                       XGI_SetCRT1Group(xgifb_info,
-                                       HwDeviceExtension, ModeNo,
-                                       ModeIdIndex, pVBInfo);
-                       if (pVBInfo->VBInfo & XGI_SetCRT2ToLCDA) {
-                               XGI_SetLCDAGroup(ModeNo, ModeIdIndex,
-                                               HwDeviceExtension,
-                                               pVBInfo);
-                       }
                }
 
                if (pVBInfo->VBInfo & (SetSimuScanMode | SwitchCRT2)) {
                        switch (HwDeviceExtension->ujVBChipID) {
-                       case VB_CHIP_301:
-                               XGI_SetCRT2Group301(ModeNo, HwDeviceExtension,
-                                               pVBInfo); /*add for CRT2 */
-                               break;
-
+                       case VB_CHIP_301: /* fall through */
                        case VB_CHIP_302:
                                XGI_SetCRT2Group301(ModeNo, HwDeviceExtension,
                                                pVBInfo); /*add for CRT2 */