Commit d3ae5762 authored by Aaro Koskinen's avatar Aaro Koskinen Committed by Greg Kroah-Hartman

staging: xgifb: use "else if"

Use "else if" when possible to reduce nesting.
Signed-off-by: default avatarAaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 14f7c111
...@@ -1397,11 +1397,10 @@ static int XGIfb_pan_display(struct fb_var_screeninfo *var, ...@@ -1397,11 +1397,10 @@ static int XGIfb_pan_display(struct fb_var_screeninfo *var,
if (var->yoffset < 0 || var->yoffset >= info->var.yres_virtual if (var->yoffset < 0 || var->yoffset >= info->var.yres_virtual
|| var->xoffset) || var->xoffset)
return -EINVAL; return -EINVAL;
} else { } else if (var->xoffset + info->var.xres > info->var.xres_virtual
if (var->xoffset + info->var.xres > info->var.xres_virtual
|| var->yoffset + info->var.yres || var->yoffset + info->var.yres
> info->var.yres_virtual) > info->var.yres_virtual) {
return -EINVAL; return -EINVAL;
} }
err = XGIfb_pan_var(var, info); err = XGIfb_pan_var(var, info);
if (err < 0) if (err < 0)
......
...@@ -116,11 +116,9 @@ static void XGI_SetSeqRegs(unsigned short ModeNo, ...@@ -116,11 +116,9 @@ static void XGI_SetSeqRegs(unsigned short ModeNo,
i = XGI_SetCRT2ToLCDA; i = XGI_SetCRT2ToLCDA;
if (pVBInfo->VBInfo & XGI_SetCRT2ToLCDA) { if (pVBInfo->VBInfo & XGI_SetCRT2ToLCDA) {
tempah |= 0x01; tempah |= 0x01;
} else { } else if (pVBInfo->VBInfo & (SetCRT2ToTV | SetCRT2ToLCD)) {
if (pVBInfo->VBInfo & (SetCRT2ToTV | SetCRT2ToLCD)) { if (pVBInfo->VBInfo & SetInSlaveMode)
if (pVBInfo->VBInfo & SetInSlaveMode) tempah |= 0x01;
tempah |= 0x01;
}
} }
tempah |= 0x20; /* screen off */ tempah |= 0x20; /* screen off */
...@@ -165,10 +163,9 @@ static void XGI_SetATTRegs(unsigned short ModeNo, ...@@ -165,10 +163,9 @@ static void XGI_SetATTRegs(unsigned short ModeNo,
if ((modeflag & Charx8Dot) && i == 0x13) { /* ifndef Dot9 */ if ((modeflag & Charx8Dot) && i == 0x13) { /* ifndef Dot9 */
if (pVBInfo->VBInfo & XGI_SetCRT2ToLCDA) { if (pVBInfo->VBInfo & XGI_SetCRT2ToLCDA) {
ARdata = 0; ARdata = 0;
} else { } else if ((pVBInfo->VBInfo &
if ((pVBInfo->VBInfo &
(SetCRT2ToTV | SetCRT2ToLCD)) && (SetCRT2ToTV | SetCRT2ToLCD)) &&
(pVBInfo->VBInfo & SetInSlaveMode)) (pVBInfo->VBInfo & SetInSlaveMode)) {
ARdata = 0; ARdata = 0;
} }
} }
...@@ -265,42 +262,38 @@ static unsigned char XGI_AjustCRT2Rate(unsigned short ModeNo, ...@@ -265,42 +262,38 @@ static unsigned char XGI_AjustCRT2Rate(unsigned short ModeNo,
(pVBInfo->SetFlag & TVSimuMode)) || (pVBInfo->SetFlag & TVSimuMode)) ||
(resinfo > 7))) (resinfo > 7)))
return 0; return 0;
} else { } else if (pVBInfo->VBInfo & (SetCRT2ToAVIDEO |
if (pVBInfo->VBInfo & (SetCRT2ToAVIDEO |
SetCRT2ToSVIDEO | SetCRT2ToSVIDEO |
SetCRT2ToSCART | SetCRT2ToSCART |
SetCRT2ToYPbPr525750 | SetCRT2ToYPbPr525750 |
SetCRT2ToHiVision)) { SetCRT2ToHiVision)) {
tempax |= SupportTV; tempax |= SupportTV;
if (pVBInfo->VBType & (VB_SIS301B | if (pVBInfo->VBType & (VB_SIS301B |
VB_SIS302B | VB_SIS302B |
VB_SIS301LV | VB_SIS301LV |
VB_SIS302LV | VB_SIS302LV |
VB_XGI301C)) VB_XGI301C))
tempax |= SupportTV1024; tempax |= SupportTV1024;
if (!(pVBInfo->VBInfo & TVSetPAL) && if (!(pVBInfo->VBInfo & TVSetPAL) &&
(modeflag & NoSupportSimuTV) && (modeflag & NoSupportSimuTV) &&
(pVBInfo->VBInfo & SetInSlaveMode) && (pVBInfo->VBInfo & SetInSlaveMode) &&
(!(pVBInfo->VBInfo & SetNotSimuMode))) (!(pVBInfo->VBInfo & SetNotSimuMode)))
return 0; return 0;
}
} }
} else { /* for LVDS */ } else if (pVBInfo->VBInfo & SetCRT2ToLCD) { /* for LVDS */
if (pVBInfo->VBInfo & SetCRT2ToLCD) { tempax |= SupportLCD;
tempax |= SupportLCD;
if (resinfo > 0x08) if (resinfo > 0x08)
return 0; /* 1024x768 */ return 0; /* 1024x768 */
if (pVBInfo->LCDResInfo < Panel_1024x768) { if (pVBInfo->LCDResInfo < Panel_1024x768) {
if (resinfo > 0x07) if (resinfo > 0x07)
return 0; /* 800x600 */ return 0; /* 800x600 */
if (resinfo == 0x04) if (resinfo == 0x04)
return 0; /* 512x384 */ return 0; /* 512x384 */
}
} }
} }
...@@ -976,13 +969,11 @@ static unsigned short XGI_GetVCLK2Ptr(unsigned short ModeNo, ...@@ -976,13 +969,11 @@ static unsigned short XGI_GetVCLK2Ptr(unsigned short ModeNo,
Ext_CRTVCLK; Ext_CRTVCLK;
VCLKIndex &= IndexMask; VCLKIndex &= IndexMask;
} }
} else { /* LVDS */ } else if ((pVBInfo->LCDResInfo == Panel_800x600) ||
if ((pVBInfo->LCDResInfo == Panel_800x600) || (pVBInfo->LCDResInfo == Panel_320x480)) { /* LVDS */
(pVBInfo->LCDResInfo == Panel_320x480)) VCLKIndex = VCLK40; /* LVDSXlat1VCLK */
VCLKIndex = VCLK40; /* LVDSXlat1VCLK */ } else {
else VCLKIndex = VCLK65_315 + 2; /* LVDSXlat2VCLK, LVDSXlat3VCLK */
VCLKIndex = VCLK65_315 + 2; /* LVDSXlat2VCLK,
LVDSXlat3VCLK */
} }
return VCLKIndex; return VCLKIndex;
...@@ -2544,11 +2535,10 @@ static void XGI_GetVBInfo(unsigned short ModeNo, unsigned short ModeIdIndex, ...@@ -2544,11 +2535,10 @@ static void XGI_GetVBInfo(unsigned short ModeNo, unsigned short ModeIdIndex,
temp = 0x09FC; temp = 0x09FC;
else else
temp = 0x097C; temp = 0x097C;
} else if (pVBInfo->IF_DEF_HiVision == 1) {
temp = 0x01FC;
} else { } else {
if (pVBInfo->IF_DEF_HiVision == 1) temp = 0x017C;
temp = 0x01FC;
else
temp = 0x017C;
} }
} else { /* 3nd party chip */ } else { /* 3nd party chip */
temp = SetCRT2ToLCD; temp = SetCRT2ToLCD;
...@@ -2720,19 +2710,17 @@ static void XGI_GetTVInfo(unsigned short ModeNo, unsigned short ModeIdIndex, ...@@ -2720,19 +2710,17 @@ static void XGI_GetTVInfo(unsigned short ModeNo, unsigned short ModeIdIndex,
if (pVBInfo->VBInfo & SetCRT2ToHiVision) { if (pVBInfo->VBInfo & SetCRT2ToHiVision) {
if (pVBInfo->VBInfo & SetInSlaveMode) if (pVBInfo->VBInfo & SetInSlaveMode)
tempbx &= (~RPLLDIV2XO); tempbx &= (~RPLLDIV2XO);
} else { } else if (tempbx &
if (tempbx & (TVSetYPbPr525p | TVSetYPbPr750p)) {
(TVSetYPbPr525p | TVSetYPbPr750p))
tempbx &= (~RPLLDIV2XO); tempbx &= (~RPLLDIV2XO);
else if (!(pVBInfo->VBType & } else if (!(pVBInfo->VBType &
(VB_SIS301B | (VB_SIS301B |
VB_SIS302B | VB_SIS302B |
VB_SIS301LV | VB_SIS301LV |
VB_SIS302LV | VB_SIS302LV |
VB_XGI301C))) { VB_XGI301C))) {
if (tempbx & TVSimuMode) if (tempbx & TVSimuMode)
tempbx &= (~RPLLDIV2XO); tempbx &= (~RPLLDIV2XO);
}
} }
} }
} }
...@@ -3865,18 +3853,16 @@ static void XGI_SetLockRegs(unsigned short ModeNo, unsigned short ModeIdIndex, ...@@ -3865,18 +3853,16 @@ static void XGI_SetLockRegs(unsigned short ModeNo, unsigned short ModeIdIndex,
} else { } else {
tempbx -= 10; tempbx -= 10;
} }
} else { } else if (pVBInfo->TVInfo & TVSimuMode) {
if (pVBInfo->TVInfo & TVSimuMode) { if (pVBInfo->TVInfo & TVSetPAL) {
if (pVBInfo->TVInfo & TVSetPAL) { if (pVBInfo->VBType & VB_SIS301LV) {
if (pVBInfo->VBType & VB_SIS301LV) { if (!(pVBInfo->TVInfo &
if (!(pVBInfo->TVInfo & (TVSetYPbPr525p |
(TVSetYPbPr525p | TVSetYPbPr750p |
TVSetYPbPr750p | TVSetHiVision)))
TVSetHiVision)))
tempbx += 40;
} else {
tempbx += 40; tempbx += 40;
} } else {
tempbx += 40;
} }
} }
} }
...@@ -4189,11 +4175,9 @@ static void XGI_SetGroup2(unsigned short ModeNo, unsigned short ModeIdIndex, ...@@ -4189,11 +4175,9 @@ static void XGI_SetGroup2(unsigned short ModeNo, unsigned short ModeIdIndex,
temp += 1; temp += 1;
} }
} }
} else { } else if (pVBInfo->VBInfo & SetInSlaveMode) {
if (pVBInfo->VBInfo & SetInSlaveMode) { if (ModeNo == 0x2f)
if (ModeNo == 0x2f) temp += 1;
temp += 1;
}
} }
} }
...@@ -4858,13 +4842,11 @@ static void XGI_SetGroup4(unsigned short ModeNo, unsigned short ModeIdIndex, ...@@ -4858,13 +4842,11 @@ static void XGI_SetGroup4(unsigned short ModeNo, unsigned short ModeIdIndex,
if (pVBInfo->VBInfo & SetCRT2ToLCD) { if (pVBInfo->VBInfo & SetCRT2ToLCD) {
if (tempax > 800) if (tempax > 800)
tempax -= 800; tempax -= 800;
} else { } else if (pVBInfo->VGAHDE > 800) {
if (pVBInfo->VGAHDE > 800) { if (pVBInfo->VGAHDE == 1024)
if (pVBInfo->VGAHDE == 1024) tempax = (tempax * 25 / 32) - 1;
tempax = (tempax * 25 / 32) - 1; else
else tempax = (tempax * 20 / 32) - 1;
tempax = (tempax * 20 / 32) - 1;
}
} }
tempax -= 1; tempax -= 1;
...@@ -6218,12 +6200,10 @@ static void XGI_EnableBridge(struct xgifb_video_info *xgifb_info, ...@@ -6218,12 +6200,10 @@ static void XGI_EnableBridge(struct xgifb_video_info *xgifb_info,
if (pVBInfo->SetFlag & EnableChA) { if (pVBInfo->SetFlag & EnableChA) {
/* Power on */ /* Power on */
xgifb_reg_set(pVBInfo->Part1Port, 0x1E, 0x20); xgifb_reg_set(pVBInfo->Part1Port, 0x1E, 0x20);
} else { } else if (pVBInfo->VBInfo & SetCRT2ToDualEdge) {
if (pVBInfo->VBInfo & SetCRT2ToDualEdge) { /* Power on */
/* Power on */ xgifb_reg_set(pVBInfo->Part1Port,
xgifb_reg_set(pVBInfo->Part1Port, 0x1E, 0x20);
0x1E, 0x20);
}
} }
} }
...@@ -6481,16 +6461,14 @@ unsigned char XGISetModeNew(struct xgifb_video_info *xgifb_info, ...@@ -6481,16 +6461,14 @@ unsigned char XGISetModeNew(struct xgifb_video_info *xgifb_info,
XGI_SetLCDAGroup(ModeNo, ModeIdIndex, XGI_SetLCDAGroup(ModeNo, ModeIdIndex,
HwDeviceExtension, pVBInfo); HwDeviceExtension, pVBInfo);
} }
} else { } else if (!(pVBInfo->VBInfo & SwitchCRT2)) {
if (!(pVBInfo->VBInfo & SwitchCRT2)) { XGI_SetCRT1Group(xgifb_info,
XGI_SetCRT1Group(xgifb_info, HwDeviceExtension, ModeNo,
HwDeviceExtension, ModeNo, ModeIdIndex, pVBInfo);
ModeIdIndex, pVBInfo); if (pVBInfo->VBInfo & XGI_SetCRT2ToLCDA) {
if (pVBInfo->VBInfo & XGI_SetCRT2ToLCDA) { XGI_SetLCDAGroup(ModeNo, ModeIdIndex,
XGI_SetLCDAGroup(ModeNo, ModeIdIndex, HwDeviceExtension,
HwDeviceExtension, pVBInfo);
pVBInfo);
}
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment