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

staging: xgifb: vb_setmode: reduce if nesting in XGI_GetVCLK2Ptr()

Eliminate unnecessary nesting levels by rearranging code and conditions.
The resulting code should be still identical.
Signed-off-by: default avatarAaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 6596fc06
...@@ -1274,9 +1274,7 @@ static unsigned short XGI_GetVCLK2Ptr(unsigned short ModeNo, ...@@ -1274,9 +1274,7 @@ static unsigned short XGI_GetVCLK2Ptr(unsigned short ModeNo,
VCLKIndex = LCDXlat2VCLK[CRT2Index]; VCLKIndex = LCDXlat2VCLK[CRT2Index];
else else
VCLKIndex = LCDXlat1VCLK[CRT2Index]; VCLKIndex = LCDXlat1VCLK[CRT2Index];
} else { /* for TV */ } else if (pVBInfo->VBInfo & SetCRT2ToHiVisionTV) {
if (pVBInfo->VBInfo & SetCRT2ToTV) {
if (pVBInfo->VBInfo & SetCRT2ToHiVisionTV) {
if (pVBInfo->SetFlag & RPLLDIV2XO) { if (pVBInfo->SetFlag & RPLLDIV2XO) {
VCLKIndex = HiTVVCLKDIV2; VCLKIndex = HiTVVCLKDIV2;
VCLKIndex += 25; VCLKIndex += 25;
...@@ -1287,66 +1285,46 @@ static unsigned short XGI_GetVCLK2Ptr(unsigned short ModeNo, ...@@ -1287,66 +1285,46 @@ static unsigned short XGI_GetVCLK2Ptr(unsigned short ModeNo,
if (pVBInfo->SetFlag & TVSimuMode) { if (pVBInfo->SetFlag & TVSimuMode) {
if (modeflag & Charx8Dot) { if (modeflag & Charx8Dot) {
VCLKIndex = VCLKIndex = HiTVSimuVCLK;
HiTVSimuVCLK;
VCLKIndex += 25; VCLKIndex += 25;
} else { } else {
VCLKIndex = VCLKIndex = HiTVTextVCLK;
HiTVTextVCLK;
VCLKIndex += 25; VCLKIndex += 25;
} }
} }
/* 301lv */ /* 301lv */
if (pVBInfo->VBType & VB_XGI301LV) { if ((pVBInfo->VBType & VB_XGI301LV) &&
if (!(pVBInfo->VBExtInfo == !(pVBInfo->VBExtInfo == VB_YPbPr1080i)) {
VB_YPbPr1080i)) { if (pVBInfo->VBExtInfo == VB_YPbPr750p)
VCLKIndex = VCLKIndex = YPbPr750pVCLK;
YPbPr750pVCLK; else if (pVBInfo->VBExtInfo == VB_YPbPr525p)
if (!(pVBInfo->VBExtInfo VCLKIndex = YPbPr525pVCLK;
== else if (pVBInfo->SetFlag & RPLLDIV2XO)
VB_YPbPr750p)) { VCLKIndex = YPbPr525iVCLK_2;
VCLKIndex = else
YPbPr525pVCLK; VCLKIndex = YPbPr525iVCLK;
if (!(pVBInfo->VBExtInfo
== VB_YPbPr525p)) {
VCLKIndex
= YPbPr525iVCLK_2;
if (!(pVBInfo->SetFlag
& RPLLDIV2XO))
VCLKIndex
= YPbPr525iVCLK;
}
}
}
} }
} else { } else if (pVBInfo->VBInfo & SetCRT2ToTV) {
if (pVBInfo->VBInfo & SetCRT2ToTV) { if (pVBInfo->SetFlag & RPLLDIV2XO) {
if (pVBInfo->SetFlag &
RPLLDIV2XO) {
VCLKIndex = TVVCLKDIV2; VCLKIndex = TVVCLKDIV2;
VCLKIndex += 25; VCLKIndex += 25;
} else { } else {
VCLKIndex = TVVCLK; VCLKIndex = TVVCLK;
VCLKIndex += 25; VCLKIndex += 25;
} }
}
}
} else { /* for CRT2 */ } else { /* for CRT2 */
/* Port 3cch */ /* Port 3cch */
VCLKIndex = (unsigned char) inb( VCLKIndex = (unsigned char) inb((pVBInfo->P3ca + 0x02));
(pVBInfo->P3ca + 0x02));
VCLKIndex = ((VCLKIndex >> 2) & 0x03); VCLKIndex = ((VCLKIndex >> 2) & 0x03);
if (ModeNo > 0x13) { if (ModeNo > 0x13) {
/* di+Ext_CRTVCLK */ /* di+Ext_CRTVCLK */
VCLKIndex = VCLKIndex = pVBInfo->RefIndex[
pVBInfo->RefIndex[
RefreshRateTableIndex]. RefreshRateTableIndex].
Ext_CRTVCLK; Ext_CRTVCLK;
VCLKIndex &= IndexMask; VCLKIndex &= IndexMask;
} }
} }
}
} else { /* LVDS */ } else { /* LVDS */
if (ModeNo <= 0x13) if (ModeNo <= 0x13)
VCLKIndex = CRT2Index; VCLKIndex = CRT2Index;
......
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