diff options
author | Aaro Koskinen <aaro.koskinen@iki.fi> | 2011-12-05 22:10:31 (GMT) |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2011-12-08 20:26:01 (GMT) |
commit | bd76127489959e5e7da4fd4990a55086026e135b (patch) | |
tree | 51e7b0ff8330a6b89ecb6b6cbccd2adc5b954e82 /drivers/staging/xgifb | |
parent | b8e719754f9a4f12d61e105d0cdbec1a583fd1c8 (diff) | |
download | linux-bd76127489959e5e7da4fd4990a55086026e135b.tar.xz |
staging: xgifb: ReadVBIOSTablData(): rearrange code to avoid nesting
Rearrange code to avoid deep nesting.
Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging/xgifb')
-rw-r--r-- | drivers/staging/xgifb/vb_init.c | 111 |
1 files changed, 51 insertions, 60 deletions
diff --git a/drivers/staging/xgifb/vb_init.c b/drivers/staging/xgifb/vb_init.c index 2d4aa06..c9b5285 100644 --- a/drivers/staging/xgifb/vb_init.c +++ b/drivers/staging/xgifb/vb_init.c @@ -1100,66 +1100,57 @@ static void ReadVBIOSTablData(unsigned char ChipType, unsigned char j, k; /* Volari customize data area end */ - if (ChipType == XG21) { - pVBInfo->IF_DEF_LVDS = 0; - if (pVideoMemory[0x65] & 0x1) { - pVBInfo->IF_DEF_LVDS = 1; - i = pVideoMemory[0x316] | (pVideoMemory[0x317] << 8); - j = pVideoMemory[i - 1]; - if (j == 0xff) - j = 1; - k = 0; - do { - pVBInfo->XG21_LVDSCapList[k].LVDS_Capability - = pVideoMemory[i] | - (pVideoMemory[i + 1] << 8); - pVBInfo->XG21_LVDSCapList[k].LVDSHT - = pVideoMemory[i + 2] | - (pVideoMemory[i + 3] << 8); - pVBInfo->XG21_LVDSCapList[k].LVDSVT - = pVideoMemory[i + 4] | - (pVideoMemory[i + 5] << 8); - pVBInfo->XG21_LVDSCapList[k].LVDSHDE - = pVideoMemory[i + 6] | - (pVideoMemory[i + 7] << 8); - pVBInfo->XG21_LVDSCapList[k].LVDSVDE - = pVideoMemory[i + 8] | - (pVideoMemory[i + 9] << 8); - pVBInfo->XG21_LVDSCapList[k].LVDSHFP - = pVideoMemory[i + 10] | - (pVideoMemory[i + 11] << 8); - pVBInfo->XG21_LVDSCapList[k].LVDSVFP - = pVideoMemory[i + 12] | - (pVideoMemory[i + 13] << 8); - pVBInfo->XG21_LVDSCapList[k].LVDSHSYNC - = pVideoMemory[i + 14] | - (pVideoMemory[i + 15] << 8); - pVBInfo->XG21_LVDSCapList[k].LVDSVSYNC - = pVideoMemory[i + 16] | - (pVideoMemory[i + 17] << 8); - pVBInfo->XG21_LVDSCapList[k].VCLKData1 - = pVideoMemory[i + 18]; - pVBInfo->XG21_LVDSCapList[k].VCLKData2 - = pVideoMemory[i + 19]; - pVBInfo->XG21_LVDSCapList[k].PSC_S1 - = pVideoMemory[i + 20]; - pVBInfo->XG21_LVDSCapList[k].PSC_S2 - = pVideoMemory[i + 21]; - pVBInfo->XG21_LVDSCapList[k].PSC_S3 - = pVideoMemory[i + 22]; - pVBInfo->XG21_LVDSCapList[k].PSC_S4 - = pVideoMemory[i + 23]; - pVBInfo->XG21_LVDSCapList[k].PSC_S5 - = pVideoMemory[i + 24]; - i += 25; - j--; - k++; - } while ((j > 0) && - (k < (sizeof(XGI21_LCDCapList) / - sizeof(struct - XGI21_LVDSCapStruct)))); - } - } + if (ChipType != XG21) + return; + pVBInfo->IF_DEF_LVDS = 0; + if (!(pVideoMemory[0x65] & 0x1)) + return; + pVBInfo->IF_DEF_LVDS = 1; + i = pVideoMemory[0x316] | (pVideoMemory[0x317] << 8); + j = pVideoMemory[i - 1]; + if (j == 0xff) + j = 1; + k = 0; + do { + pVBInfo->XG21_LVDSCapList[k].LVDS_Capability + = pVideoMemory[i] | (pVideoMemory[i + 1] << 8); + pVBInfo->XG21_LVDSCapList[k].LVDSHT + = pVideoMemory[i + 2] | + (pVideoMemory[i + 3] << 8); + pVBInfo->XG21_LVDSCapList[k].LVDSVT + = pVideoMemory[i + 4] | + (pVideoMemory[i + 5] << 8); + pVBInfo->XG21_LVDSCapList[k].LVDSHDE + = pVideoMemory[i + 6] | + (pVideoMemory[i + 7] << 8); + pVBInfo->XG21_LVDSCapList[k].LVDSVDE + = pVideoMemory[i + 8] | + (pVideoMemory[i + 9] << 8); + pVBInfo->XG21_LVDSCapList[k].LVDSHFP + = pVideoMemory[i + 10] | + (pVideoMemory[i + 11] << 8); + pVBInfo->XG21_LVDSCapList[k].LVDSVFP + = pVideoMemory[i + 12] | + (pVideoMemory[i + 13] << 8); + pVBInfo->XG21_LVDSCapList[k].LVDSHSYNC + = pVideoMemory[i + 14] | + (pVideoMemory[i + 15] << 8); + pVBInfo->XG21_LVDSCapList[k].LVDSVSYNC + = pVideoMemory[i + 16] | + (pVideoMemory[i + 17] << 8); + pVBInfo->XG21_LVDSCapList[k].VCLKData1 = pVideoMemory[i + 18]; + pVBInfo->XG21_LVDSCapList[k].VCLKData2 = pVideoMemory[i + 19]; + pVBInfo->XG21_LVDSCapList[k].PSC_S1 = pVideoMemory[i + 20]; + pVBInfo->XG21_LVDSCapList[k].PSC_S2 = pVideoMemory[i + 21]; + pVBInfo->XG21_LVDSCapList[k].PSC_S3 = pVideoMemory[i + 22]; + pVBInfo->XG21_LVDSCapList[k].PSC_S4 = pVideoMemory[i + 23]; + pVBInfo->XG21_LVDSCapList[k].PSC_S5 = pVideoMemory[i + 24]; + i += 25; + j--; + k++; + } while ((j > 0) && + (k < (sizeof(XGI21_LCDCapList) / + sizeof(struct XGI21_LVDSCapStruct)))); } static void XGINew_ChkSenseStatus(struct xgi_hw_device_info *HwDeviceExtension, |