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,10 +1397,9 @@ static int XGIfb_pan_display(struct fb_var_screeninfo *var,
if (var->yoffset < 0 || var->yoffset >= info->var.yres_virtual
|| var->xoffset)
return -EINVAL;
} else {
if (var->xoffset + info->var.xres > info->var.xres_virtual
} else if (var->xoffset + info->var.xres > info->var.xres_virtual
|| var->yoffset + info->var.yres
> info->var.yres_virtual)
> info->var.yres_virtual) {
return -EINVAL;
}
err = XGIfb_pan_var(var, info);
......
......@@ -116,12 +116,10 @@ static void XGI_SetSeqRegs(unsigned short ModeNo,
i = XGI_SetCRT2ToLCDA;
if (pVBInfo->VBInfo & XGI_SetCRT2ToLCDA) {
tempah |= 0x01;
} else {
if (pVBInfo->VBInfo & (SetCRT2ToTV | SetCRT2ToLCD)) {
} else if (pVBInfo->VBInfo & (SetCRT2ToTV | SetCRT2ToLCD)) {
if (pVBInfo->VBInfo & SetInSlaveMode)
tempah |= 0x01;
}
}
tempah |= 0x20; /* screen off */
xgifb_reg_set(pVBInfo->P3c4, 0x01, tempah); /* Set SR1 */
......@@ -165,10 +163,9 @@ static void XGI_SetATTRegs(unsigned short ModeNo,
if ((modeflag & Charx8Dot) && i == 0x13) { /* ifndef Dot9 */
if (pVBInfo->VBInfo & XGI_SetCRT2ToLCDA) {
ARdata = 0;
} else {
if ((pVBInfo->VBInfo &
} else if ((pVBInfo->VBInfo &
(SetCRT2ToTV | SetCRT2ToLCD)) &&
(pVBInfo->VBInfo & SetInSlaveMode))
(pVBInfo->VBInfo & SetInSlaveMode)) {
ARdata = 0;
}
}
......@@ -265,8 +262,7 @@ static unsigned char XGI_AjustCRT2Rate(unsigned short ModeNo,
(pVBInfo->SetFlag & TVSimuMode)) ||
(resinfo > 7)))
return 0;
} else {
if (pVBInfo->VBInfo & (SetCRT2ToAVIDEO |
} else if (pVBInfo->VBInfo & (SetCRT2ToAVIDEO |
SetCRT2ToSVIDEO |
SetCRT2ToSCART |
SetCRT2ToYPbPr525750 |
......@@ -286,9 +282,7 @@ static unsigned char XGI_AjustCRT2Rate(unsigned short ModeNo,
(!(pVBInfo->VBInfo & SetNotSimuMode)))
return 0;
}
}
} else { /* for LVDS */
if (pVBInfo->VBInfo & SetCRT2ToLCD) {
} else if (pVBInfo->VBInfo & SetCRT2ToLCD) { /* for LVDS */
tempax |= SupportLCD;
if (resinfo > 0x08)
......@@ -302,7 +296,6 @@ static unsigned char XGI_AjustCRT2Rate(unsigned short ModeNo,
return 0; /* 512x384 */
}
}
}
for (; pVBInfo->RefIndex[RefreshRateTableIndex + (*i)].ModeID ==
tempbx; (*i)--) {
......@@ -976,13 +969,11 @@ static unsigned short XGI_GetVCLK2Ptr(unsigned short ModeNo,
Ext_CRTVCLK;
VCLKIndex &= IndexMask;
}
} else { /* LVDS */
if ((pVBInfo->LCDResInfo == Panel_800x600) ||
(pVBInfo->LCDResInfo == Panel_320x480))
} else if ((pVBInfo->LCDResInfo == Panel_800x600) ||
(pVBInfo->LCDResInfo == Panel_320x480)) { /* LVDS */
VCLKIndex = VCLK40; /* LVDSXlat1VCLK */
else
VCLKIndex = VCLK65_315 + 2; /* LVDSXlat2VCLK,
LVDSXlat3VCLK */
} else {
VCLKIndex = VCLK65_315 + 2; /* LVDSXlat2VCLK, LVDSXlat3VCLK */
}
return VCLKIndex;
......@@ -2544,10 +2535,9 @@ static void XGI_GetVBInfo(unsigned short ModeNo, unsigned short ModeIdIndex,
temp = 0x09FC;
else
temp = 0x097C;
} else {
if (pVBInfo->IF_DEF_HiVision == 1)
} else if (pVBInfo->IF_DEF_HiVision == 1) {
temp = 0x01FC;
else
} else {
temp = 0x017C;
}
} else { /* 3nd party chip */
......@@ -2720,11 +2710,10 @@ static void XGI_GetTVInfo(unsigned short ModeNo, unsigned short ModeIdIndex,
if (pVBInfo->VBInfo & SetCRT2ToHiVision) {
if (pVBInfo->VBInfo & SetInSlaveMode)
tempbx &= (~RPLLDIV2XO);
} else {
if (tempbx &
(TVSetYPbPr525p | TVSetYPbPr750p))
} else if (tempbx &
(TVSetYPbPr525p | TVSetYPbPr750p)) {
tempbx &= (~RPLLDIV2XO);
else if (!(pVBInfo->VBType &
} else if (!(pVBInfo->VBType &
(VB_SIS301B |
VB_SIS302B |
VB_SIS301LV |
......@@ -2735,7 +2724,6 @@ static void XGI_GetTVInfo(unsigned short ModeNo, unsigned short ModeIdIndex,
}
}
}
}
pVBInfo->TVInfo = tempbx;
}
......@@ -3865,8 +3853,7 @@ static void XGI_SetLockRegs(unsigned short ModeNo, unsigned short ModeIdIndex,
} else {
tempbx -= 10;
}
} else {
if (pVBInfo->TVInfo & TVSimuMode) {
} else if (pVBInfo->TVInfo & TVSimuMode) {
if (pVBInfo->TVInfo & TVSetPAL) {
if (pVBInfo->VBType & VB_SIS301LV) {
if (!(pVBInfo->TVInfo &
......@@ -3879,7 +3866,6 @@ static void XGI_SetLockRegs(unsigned short ModeNo, unsigned short ModeIdIndex,
}
}
}
}
tempax = push1;
tempax = tempax >> 2;
tempax++;
......@@ -4189,13 +4175,11 @@ static void XGI_SetGroup2(unsigned short ModeNo, unsigned short ModeIdIndex,
temp += 1;
}
}
} else {
if (pVBInfo->VBInfo & SetInSlaveMode) {
} else if (pVBInfo->VBInfo & SetInSlaveMode) {
if (ModeNo == 0x2f)
temp += 1;
}
}
}
xgifb_reg_set(pVBInfo->Part2Port, 0x2F, temp);
......@@ -4858,14 +4842,12 @@ static void XGI_SetGroup4(unsigned short ModeNo, unsigned short ModeIdIndex,
if (pVBInfo->VBInfo & SetCRT2ToLCD) {
if (tempax > 800)
tempax -= 800;
} else {
if (pVBInfo->VGAHDE > 800) {
} else if (pVBInfo->VGAHDE > 800) {
if (pVBInfo->VGAHDE == 1024)
tempax = (tempax * 25 / 32) - 1;
else
tempax = (tempax * 20 / 32) - 1;
}
}
tempax -= 1;
temp = (tempax & 0xFF00) >> 8;
......@@ -6218,14 +6200,12 @@ static void XGI_EnableBridge(struct xgifb_video_info *xgifb_info,
if (pVBInfo->SetFlag & EnableChA) {
/* Power on */
xgifb_reg_set(pVBInfo->Part1Port, 0x1E, 0x20);
} else {
if (pVBInfo->VBInfo & SetCRT2ToDualEdge) {
} else if (pVBInfo->VBInfo & SetCRT2ToDualEdge) {
/* Power on */
xgifb_reg_set(pVBInfo->Part1Port,
0x1E, 0x20);
}
}
}
if (!(pVBInfo->SetFlag & DisableChB)) {
if ((pVBInfo->SetFlag & EnableChB) || (pVBInfo->VBInfo
......@@ -6481,8 +6461,7 @@ unsigned char XGISetModeNew(struct xgifb_video_info *xgifb_info,
XGI_SetLCDAGroup(ModeNo, ModeIdIndex,
HwDeviceExtension, pVBInfo);
}
} else {
if (!(pVBInfo->VBInfo & SwitchCRT2)) {
} else if (!(pVBInfo->VBInfo & SwitchCRT2)) {
XGI_SetCRT1Group(xgifb_info,
HwDeviceExtension, ModeNo,
ModeIdIndex, pVBInfo);
......@@ -6492,7 +6471,6 @@ unsigned char XGISetModeNew(struct xgifb_video_info *xgifb_info,
pVBInfo);
}
}
}
if (pVBInfo->VBInfo & (SetSimuScanMode | SwitchCRT2)) {
switch (HwDeviceExtension->ujVBChipID) {
......
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