From: Miguel Gómez Date: Fri, 6 Jul 2012 10:40:47 +0000 (+0200) Subject: Staging: xgifb: Refactor XGI_GetVBType(). X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=7eec23a7b3dd0bcb9b64c0627b317464765e2426;p=linux-beck.git Staging: xgifb: Refactor XGI_GetVBType(). Refactor XGI_GetVBType() to reduce indentation and fix style warnings. Signed-off-by: Miguel Gómez Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/xgifb/vb_setmode.c b/drivers/staging/xgifb/vb_setmode.c index 03edf36e18df..251145ea0f39 100644 --- a/drivers/staging/xgifb/vb_setmode.c +++ b/drivers/staging/xgifb/vb_setmode.c @@ -2559,42 +2559,45 @@ void XGI_GetVBType(struct vb_device_info *pVBInfo) { unsigned short flag, tempbx, tempah; - if (pVBInfo->IF_DEF_LVDS == 0) { - tempbx = VB_SIS302B; - flag = xgifb_reg_get(pVBInfo->Part4Port, 0x00); - if (flag != 0x02) { - tempbx = VB_SIS301; - flag = xgifb_reg_get(pVBInfo->Part4Port, 0x01); - if (flag >= 0xB0) { - tempbx = VB_SIS301B; - if (flag >= 0xC0) { - tempbx = VB_XGI301C; - if (flag >= 0xD0) { - tempbx = VB_SIS301LV; - if (flag >= 0xE0) { - tempbx = VB_SIS302LV; - tempah = xgifb_reg_get( - pVBInfo->Part4Port, - 0x39); - if (tempah != 0xFF) - tempbx = - VB_XGI301C; - } - } - } + if (pVBInfo->IF_DEF_LVDS != 0) + return; - if (tempbx & (VB_SIS301B | VB_SIS302B)) { - flag = xgifb_reg_get( - pVBInfo->Part4Port, - 0x23); + tempbx = VB_SIS302B; + flag = xgifb_reg_get(pVBInfo->Part4Port, 0x00); + if (flag == 0x02) + goto finish; - if (!(flag & 0x02)) - tempbx = tempbx | VB_NoLCD; - } - } - } - pVBInfo->VBType = tempbx; + tempbx = VB_SIS301; + flag = xgifb_reg_get(pVBInfo->Part4Port, 0x01); + if (flag < 0xB0) + goto finish; + + tempbx = VB_SIS301B; + if (flag < 0xC0) + goto bigger_than_0xB0; + + tempbx = VB_XGI301C; + if (flag < 0xD0) + goto bigger_than_0xB0; + + tempbx = VB_SIS301LV; + if (flag < 0xE0) + goto bigger_than_0xB0; + + tempbx = VB_SIS302LV; + tempah = xgifb_reg_get(pVBInfo->Part4Port, 0x39); + if (tempah != 0xFF) + tempbx = VB_XGI301C; + +bigger_than_0xB0: + if (tempbx & (VB_SIS301B | VB_SIS302B)) { + flag = xgifb_reg_get(pVBInfo->Part4Port, 0x23); + if (!(flag & 0x02)) + tempbx = tempbx | VB_NoLCD; } + +finish: + pVBInfo->VBType = tempbx; } static void XGI_GetVBInfo(unsigned short ModeNo, unsigned short ModeIdIndex,