Skip to content

Commit

Permalink
staging: xgifb: vb_setmode: reduce if nesting in XGI_SetLockRegs()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Aaro Koskinen authored and Greg Kroah-Hartman committed Nov 27, 2011
1 parent ebe3302 commit 6596fc0
Showing 1 changed file with 16 additions and 29 deletions.
45 changes: 16 additions & 29 deletions drivers/staging/xgifb/vb_setmode.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
}
Expand Down

0 comments on commit 6596fc0

Please sign in to comment.