From nobody Fri Apr 10 20:26:24 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AFF0DC32772 for ; Fri, 19 Aug 2022 11:05:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348497AbiHSLFT (ORCPT ); Fri, 19 Aug 2022 07:05:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49090 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348577AbiHSLEn (ORCPT ); Fri, 19 Aug 2022 07:04:43 -0400 Received: from out30-133.freemail.mail.aliyun.com (out30-133.freemail.mail.aliyun.com [115.124.30.133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 17EA6FAC4C; Fri, 19 Aug 2022 04:04:36 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R121e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018045176;MF=jiapeng.chong@linux.alibaba.com;NM=1;PH=DS;RN=7;SR=0;TI=SMTPD_---0VMg-lTI_1660907055; Received: from localhost(mailfrom:jiapeng.chong@linux.alibaba.com fp:SMTPD_---0VMg-lTI_1660907055) by smtp.aliyun-inc.com; Fri, 19 Aug 2022 19:04:34 +0800 From: Jiapeng Chong To: thomas@winischhofer.net Cc: deller@gmx.de, linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Jiapeng Chong , Abaci Robot Subject: [PATCH] video: fbdev: sis_main: Clean up some inconsistent indenting Date: Fri, 19 Aug 2022 19:04:14 +0800 Message-Id: <20220819110414.107565-1-jiapeng.chong@linux.alibaba.com> X-Mailer: git-send-email 2.20.1.7.g153144c MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" No functional modification involved. drivers/video/fbdev/sis/sis_main.c:6165 sisfb_probe() warn: inconsistent in= denting. drivers/video/fbdev/sis/sis_main.c:4266 sisfb_post_300_rwtest() warn: incon= sistent indenting. drivers/video/fbdev/sis/sis_main.c:2388 SISDoSense() warn: inconsistent ind= enting. drivers/video/fbdev/sis/sis_main.c:2531 SiS_Sense30x() warn: inconsistent i= ndenting. drivers/video/fbdev/sis/sis_main.c:2382 SISDoSense() warn: inconsistent ind= enting. drivers/video/fbdev/sis/sis_main.c:2250 sisfb_sense_crt1() warn: inconsiste= nt indenting. drivers/video/fbdev/sis/sis_main.c:672 sisfb_validate_mode() warn: inconsis= tent indenting. Link: https://bugzilla.openanolis.cn/show_bug.cgi?id=3D1934 Reported-by: Abaci Robot Signed-off-by: Jiapeng Chong --- drivers/video/fbdev/sis/sis_main.c | 274 +++++++++++++++-------------- 1 file changed, 141 insertions(+), 133 deletions(-) diff --git a/drivers/video/fbdev/sis/sis_main.c b/drivers/video/fbdev/sis/s= is_main.c index 7114c5c17c91..ac4680a74d78 100644 --- a/drivers/video/fbdev/sis/sis_main.c +++ b/drivers/video/fbdev/sis/sis_main.c @@ -650,37 +650,37 @@ sisfb_validate_mode(struct sis_video_info *ivideo, in= t myindex, u32 vbflags) u16 xres=3D0, yres, myres; =20 #ifdef CONFIG_FB_SIS_300 - if(ivideo->sisvga_engine =3D=3D SIS_300_VGA) { - if(!(sisbios_mode[myindex].chipset & MD_SIS300)) + if (ivideo->sisvga_engine =3D=3D SIS_300_VGA) { + if (!(sisbios_mode[myindex].chipset & MD_SIS300)) return -1 ; } #endif #ifdef CONFIG_FB_SIS_315 - if(ivideo->sisvga_engine =3D=3D SIS_315_VGA) { - if(!(sisbios_mode[myindex].chipset & MD_SIS315)) + if (ivideo->sisvga_engine =3D=3D SIS_315_VGA) { + if (!(sisbios_mode[myindex].chipset & MD_SIS315)) return -1; } #endif =20 myres =3D sisbios_mode[myindex].yres; =20 - switch(vbflags & VB_DISPTYPE_DISP2) { + switch (vbflags & VB_DISPTYPE_DISP2) { =20 case CRT2_LCD: xres =3D ivideo->lcdxres; yres =3D ivideo->lcdyres; =20 - if((ivideo->SiS_Pr.SiS_CustomT !=3D CUT_PANEL848) && - (ivideo->SiS_Pr.SiS_CustomT !=3D CUT_PANEL856)) { - if(sisbios_mode[myindex].xres > xres) + if ((ivideo->SiS_Pr.SiS_CustomT !=3D CUT_PANEL848) && + (ivideo->SiS_Pr.SiS_CustomT !=3D CUT_PANEL856)) { + if (sisbios_mode[myindex].xres > xres) return -1; - if(myres > yres) + if (myres > yres) return -1; } =20 - if(ivideo->sisfb_fstn) { - if(sisbios_mode[myindex].xres =3D=3D 320) { - if(myres =3D=3D 240) { - switch(sisbios_mode[myindex].mode_no[1]) { + if (ivideo->sisfb_fstn) { + if (sisbios_mode[myindex].xres =3D=3D 320) { + if (myres =3D=3D 240) { + switch (sisbios_mode[myindex].mode_no[1]) { case 0x50: myindex =3D MODE_FSTN_8; break; case 0x56: myindex =3D MODE_FSTN_16; break; case 0x53: return -1; @@ -689,7 +689,7 @@ sisfb_validate_mode(struct sis_video_info *ivideo, int = myindex, u32 vbflags) } } =20 - if(SiS_GetModeID_LCD(ivideo->sisvga_engine, vbflags, sisbios_mode[myinde= x].xres, + if (SiS_GetModeID_LCD(ivideo->sisvga_engine, vbflags, sisbios_mode[myind= ex].xres, sisbios_mode[myindex].yres, 0, ivideo->sisfb_fstn, ivideo->SiS_Pr.SiS_CustomT, xres, yres, ivideo->vbflags2) < 0x14) { return -1; @@ -697,14 +697,14 @@ sisfb_validate_mode(struct sis_video_info *ivideo, in= t myindex, u32 vbflags) break; =20 case CRT2_TV: - if(SiS_GetModeID_TV(ivideo->sisvga_engine, vbflags, sisbios_mode[myindex= ].xres, + if (SiS_GetModeID_TV(ivideo->sisvga_engine, vbflags, sisbios_mode[myinde= x].xres, sisbios_mode[myindex].yres, 0, ivideo->vbflags2) < 0x14) { return -1; } break; =20 case CRT2_VGA: - if(SiS_GetModeID_VGA2(ivideo->sisvga_engine, vbflags, sisbios_mode[myind= ex].xres, + if (SiS_GetModeID_VGA2(ivideo->sisvga_engine, vbflags, sisbios_mode[myin= dex].xres, sisbios_mode[myindex].yres, 0, ivideo->vbflags2) < 0x14) { return -1; } @@ -2205,82 +2205,88 @@ static bool sisfb_test_DDC1(struct sis_video_info *= ivideo) =20 static void sisfb_sense_crt1(struct sis_video_info *ivideo) { - bool mustwait =3D false; - u8 sr1F, cr17; + bool mustwait =3D false; + u8 sr1F, cr17; #ifdef CONFIG_FB_SIS_315 - u8 cr63=3D0; + u8 cr63 =3D 0; #endif - u16 temp =3D 0xffff; - int i; + u16 temp =3D 0xffff; + int i; + + sr1F =3D SiS_GetReg(SISSR, 0x1F); + SiS_SetRegOR(SISSR, 0x1F, 0x04); + SiS_SetRegAND(SISSR, 0x1F, 0x3F); =20 - sr1F =3D SiS_GetReg(SISSR, 0x1F); - SiS_SetRegOR(SISSR, 0x1F, 0x04); - SiS_SetRegAND(SISSR, 0x1F, 0x3F); - if(sr1F & 0xc0) mustwait =3D true; + if (sr1F & 0xc0) + mustwait =3D true; =20 #ifdef CONFIG_FB_SIS_315 - if(ivideo->sisvga_engine =3D=3D SIS_315_VGA) { - cr63 =3D SiS_GetReg(SISCR, ivideo->SiS_Pr.SiS_MyCR63); - cr63 &=3D 0x40; - SiS_SetRegAND(SISCR, ivideo->SiS_Pr.SiS_MyCR63, 0xBF); - } + if (ivideo->sisvga_engine =3D=3D SIS_315_VGA) { + cr63 =3D SiS_GetReg(SISCR, ivideo->SiS_Pr.SiS_MyCR63); + cr63 &=3D 0x40; + SiS_SetRegAND(SISCR, ivideo->SiS_Pr.SiS_MyCR63, 0xBF); + } #endif =20 - cr17 =3D SiS_GetReg(SISCR, 0x17); - cr17 &=3D 0x80; - if(!cr17) { - SiS_SetRegOR(SISCR, 0x17, 0x80); - mustwait =3D true; - SiS_SetReg(SISSR, 0x00, 0x01); - SiS_SetReg(SISSR, 0x00, 0x03); - } + cr17 =3D SiS_GetReg(SISCR, 0x17); + cr17 &=3D 0x80; =20 - if(mustwait) { - for(i=3D0; i < 10; i++) sisfbwaitretracecrt1(ivideo); - } + if (!cr17) { + SiS_SetRegOR(SISCR, 0x17, 0x80); + mustwait =3D true; + SiS_SetReg(SISSR, 0x00, 0x01); + SiS_SetReg(SISSR, 0x00, 0x03); + } =20 + if (mustwait) { + for (i =3D 0; i < 10; i++) + sisfbwaitretracecrt1(ivideo); + } #ifdef CONFIG_FB_SIS_315 - if(ivideo->chip >=3D SIS_330) { - SiS_SetRegAND(SISCR, 0x32, ~0x20); - if(ivideo->chip >=3D SIS_340) { - SiS_SetReg(SISCR, 0x57, 0x4a); - } else { - SiS_SetReg(SISCR, 0x57, 0x5f); - } - SiS_SetRegOR(SISCR, 0x53, 0x02); - while ((SiS_GetRegByte(SISINPSTAT)) & 0x01) break; - while (!((SiS_GetRegByte(SISINPSTAT)) & 0x01)) break; - if ((SiS_GetRegByte(SISMISCW)) & 0x10) temp =3D 1; - SiS_SetRegAND(SISCR, 0x53, 0xfd); - SiS_SetRegAND(SISCR, 0x57, 0x00); - } + if (ivideo->chip >=3D SIS_330) { + SiS_SetRegAND(SISCR, 0x32, ~0x20); + if (ivideo->chip >=3D SIS_340) + SiS_SetReg(SISCR, 0x57, 0x4a); + else + SiS_SetReg(SISCR, 0x57, 0x5f); + + SiS_SetRegOR(SISCR, 0x53, 0x02); + while ((SiS_GetRegByte(SISINPSTAT)) & 0x01) + break; + while (!((SiS_GetRegByte(SISINPSTAT)) & 0x01)) + break; + if ((SiS_GetRegByte(SISMISCW)) & 0x10) + temp =3D 1; + + SiS_SetRegAND(SISCR, 0x53, 0xfd); + SiS_SetRegAND(SISCR, 0x57, 0x00); + } #endif =20 - if(temp =3D=3D 0xffff) { - i =3D 3; - do { - temp =3D SiS_HandleDDC(&ivideo->SiS_Pr, ivideo->vbflags, - ivideo->sisvga_engine, 0, 0, NULL, ivideo->vbflags2); - } while(((temp =3D=3D 0) || (temp =3D=3D 0xffff)) && i--); + if (temp =3D=3D 0xffff) { + i =3D 3; =20 - if((temp =3D=3D 0) || (temp =3D=3D 0xffff)) { - if(sisfb_test_DDC1(ivideo)) temp =3D 1; - } - } + do { + temp =3D SiS_HandleDDC(&ivideo->SiS_Pr, ivideo->vbflags, + ivideo->sisvga_engine, 0, 0, NULL, ivideo->vbflags2); + } while (((temp =3D=3D 0) || (temp =3D=3D 0xffff)) && i--); =20 - if((temp) && (temp !=3D 0xffff)) { - SiS_SetRegOR(SISCR, 0x32, 0x20); - } + if ((temp =3D=3D 0) || (temp =3D=3D 0xffff)) { + if (sisfb_test_DDC1(ivideo)) + temp =3D 1; + } + } + + if ((temp) && (temp !=3D 0xffff)) + SiS_SetRegOR(SISCR, 0x32, 0x20); =20 #ifdef CONFIG_FB_SIS_315 - if(ivideo->sisvga_engine =3D=3D SIS_315_VGA) { - SiS_SetRegANDOR(SISCR, ivideo->SiS_Pr.SiS_MyCR63, 0xBF, cr63); - } + if (ivideo->sisvga_engine =3D=3D SIS_315_VGA) + SiS_SetRegANDOR(SISCR, ivideo->SiS_Pr.SiS_MyCR63, 0xBF, cr63); #endif =20 - SiS_SetRegANDOR(SISCR, 0x17, 0x7F, cr17); - - SiS_SetReg(SISSR, 0x1F, sr1F); + SiS_SetRegANDOR(SISCR, 0x17, 0x7F, cr17); + SiS_SetReg(SISSR, 0x1F, sr1F); } =20 /* Determine and detect attached devices on SiS30x */ @@ -2294,25 +2300,25 @@ static void SiS_SenseLCD(struct sis_video_info *ivi= deo) ivideo->SiS_Pr.PanelSelfDetected =3D false; =20 /* LCD detection only for TMDS bridges */ - if(!(ivideo->vbflags2 & VB2_SISTMDSBRIDGE)) + if (!(ivideo->vbflags2 & VB2_SISTMDSBRIDGE)) return; - if(ivideo->vbflags2 & VB2_30xBDH) + if (ivideo->vbflags2 & VB2_30xBDH) return; =20 /* If LCD already set up by BIOS, skip it */ reg =3D SiS_GetReg(SISCR, 0x32); - if(reg & 0x08) + if (reg & 0x08) return; =20 realcrtno =3D 1; - if(ivideo->SiS_Pr.DDCPortMixup) + if (ivideo->SiS_Pr.DDCPortMixup) realcrtno =3D 0; =20 /* Check DDC capabilities */ temp =3D SiS_HandleDDC(&ivideo->SiS_Pr, ivideo->vbflags, ivideo->sisvga_e= ngine, realcrtno, 0, &buffer[0], ivideo->vbflags2); =20 - if((!temp) || (temp =3D=3D 0xffff) || (!(temp & 0x02))) + if ((!temp) || (temp =3D=3D 0xffff) || (!(temp & 0x02))) return; =20 /* Read DDC data */ @@ -2321,17 +2327,17 @@ static void SiS_SenseLCD(struct sis_video_info *ivi= deo) temp =3D SiS_HandleDDC(&ivideo->SiS_Pr, ivideo->vbflags, ivideo->sisvga_engine, realcrtno, 1, &buffer[0], ivideo->vbflags2); - } while((temp) && i--); + } while ((temp) && i--); =20 - if(temp) + if (temp) return; =20 /* No digital device */ - if(!(buffer[0x14] & 0x80)) + if (!(buffer[0x14] & 0x80)) return; =20 /* First detailed timing preferred timing? */ - if(!(buffer[0x18] & 0x02)) + if (!(buffer[0x18] & 0x02)) return; =20 xres =3D buffer[0x38] | ((buffer[0x3a] & 0xf0) << 4); @@ -2339,26 +2345,26 @@ static void SiS_SenseLCD(struct sis_video_info *ivi= deo) =20 switch(xres) { case 1024: - if(yres =3D=3D 768) + if (yres =3D=3D 768) paneltype =3D 0x02; break; case 1280: - if(yres =3D=3D 1024) + if (yres =3D=3D 1024) paneltype =3D 0x03; break; case 1600: - if((yres =3D=3D 1200) && (ivideo->vbflags2 & VB2_30xC)) + if ((yres =3D=3D 1200) && (ivideo->vbflags2 & VB2_30xC)) paneltype =3D 0x0b; break; } =20 - if(!paneltype) + if (!paneltype) return; =20 - if(buffer[0x23]) + if (buffer[0x23]) cr37 |=3D 0x10; =20 - if((buffer[0x47] & 0x18) =3D=3D 0x18) + if ((buffer[0x47] & 0x18) =3D=3D 0x18) cr37 |=3D ((((buffer[0x47] & 0x06) ^ 0x06) << 5) | 0x20); else cr37 |=3D 0xc0; @@ -2373,31 +2379,34 @@ static void SiS_SenseLCD(struct sis_video_info *ivi= deo) =20 static int SISDoSense(struct sis_video_info *ivideo, u16 type, u16 test) { - int temp, mytest, result, i, j; - - for(j =3D 0; j < 10; j++) { - result =3D 0; - for(i =3D 0; i < 3; i++) { - mytest =3D test; - SiS_SetReg(SISPART4, 0x11, (type & 0x00ff)); - temp =3D (type >> 8) | (mytest & 0x00ff); - SiS_SetRegANDOR(SISPART4, 0x10, 0xe0, temp); - SiS_DDC2Delay(&ivideo->SiS_Pr, 0x1500); - mytest >>=3D 8; - mytest &=3D 0x7f; - temp =3D SiS_GetReg(SISPART4, 0x03); - temp ^=3D 0x0e; - temp &=3D mytest; - if(temp =3D=3D mytest) result++; + int temp, mytest, result, i, j; + + for (j =3D 0; j < 10; j++) { + result =3D 0; + for (i =3D 0; i < 3; i++) { + mytest =3D test; + SiS_SetReg(SISPART4, 0x11, (type & 0x00ff)); + temp =3D (type >> 8) | (mytest & 0x00ff); + SiS_SetRegANDOR(SISPART4, 0x10, 0xe0, temp); + SiS_DDC2Delay(&ivideo->SiS_Pr, 0x1500); + mytest >>=3D 8; + mytest &=3D 0x7f; + temp =3D SiS_GetReg(SISPART4, 0x03); + temp ^=3D 0x0e; + temp &=3D mytest; + if (temp =3D=3D mytest) + result++; #if 1 - SiS_SetReg(SISPART4, 0x11, 0x00); - SiS_SetRegAND(SISPART4, 0x10, 0xe0); - SiS_DDC2Delay(&ivideo->SiS_Pr, 0x1000); + SiS_SetReg(SISPART4, 0x11, 0x00); + SiS_SetRegAND(SISPART4, 0x10, 0xe0); + SiS_DDC2Delay(&ivideo->SiS_Pr, 0x1000); #endif - } - if((result =3D=3D 0) || (result >=3D 2)) break; - } - return result; + } + + if ((result =3D=3D 0) || (result >=3D 2)) + break; + } + return result; } =20 static void SiS_Sense30x(struct sis_video_info *ivideo) @@ -4263,18 +4272,17 @@ static int sisfb_post_300_rwtest(struct sis_video_i= nfo *ivideo, int iteration, unsigned int k, RankCapacity, PageCapacity, BankNumHigh, BankNumMid; unsigned int PhysicalAdrOtherPage, PhysicalAdrHigh, PhysicalAdrHalfPage; =20 - for(k =3D 0; k < ARRAY_SIZE(SiS_DRAMType); k++) { - + for (k =3D 0; k < ARRAY_SIZE(SiS_DRAMType); k++) { RankCapacity =3D buswidth * SiS_DRAMType[k][3]; =20 - if(RankCapacity !=3D PseudoRankCapacity) + if (RankCapacity !=3D PseudoRankCapacity) continue; =20 - if((SiS_DRAMType[k][2] + SiS_DRAMType[k][0]) > PseudoAdrPinCount) + if ((SiS_DRAMType[k][2] + SiS_DRAMType[k][0]) > PseudoAdrPinCount) continue; =20 BankNumHigh =3D RankCapacity * 16 * iteration - 1; - if(iteration =3D=3D 3) { /* Rank No */ + if (iteration =3D=3D 3) { /* Rank No */ BankNumMid =3D RankCapacity * 16 - 1; } else { BankNumMid =3D RankCapacity * 16 * iteration / 2 - 1; @@ -4288,18 +4296,22 @@ static int sisfb_post_300_rwtest(struct sis_video_i= nfo *ivideo, int iteration, SiS_SetRegAND(SISSR, 0x15, 0xFB); /* Test */ SiS_SetRegOR(SISSR, 0x15, 0x04); /* Test */ sr14 =3D (SiS_DRAMType[k][3] * buswidth) - 1; - if(buswidth =3D=3D 4) sr14 |=3D 0x80; - else if(buswidth =3D=3D 2) sr14 |=3D 0x40; + + if (buswidth =3D=3D 4) + sr14 |=3D 0x80; + else if (buswidth =3D=3D 2) + sr14 |=3D 0x40; + SiS_SetReg(SISSR, 0x13, SiS_DRAMType[k][4]); SiS_SetReg(SISSR, 0x14, sr14); =20 BankNumHigh <<=3D 16; BankNumMid <<=3D 16; =20 - if((BankNumHigh + PhysicalAdrHigh >=3D mapsize) || - (BankNumMid + PhysicalAdrHigh >=3D mapsize) || - (BankNumHigh + PhysicalAdrHalfPage >=3D mapsize) || - (BankNumHigh + PhysicalAdrOtherPage >=3D mapsize)) + if ((BankNumHigh + PhysicalAdrHigh >=3D mapsize) || + (BankNumMid + PhysicalAdrHigh >=3D mapsize) || + (BankNumHigh + PhysicalAdrHalfPage >=3D mapsize) || + (BankNumHigh + PhysicalAdrOtherPage >=3D mapsize)) continue; =20 /* Write data */ @@ -4313,7 +4325,7 @@ static int sisfb_post_300_rwtest(struct sis_video_inf= o *ivideo, int iteration, (FBAddr + BankNumHigh + PhysicalAdrOtherPage)); =20 /* Read data */ - if(readw(FBAddr + BankNumHigh + PhysicalAdrHigh) =3D=3D PhysicalAdrHigh) + if (readw(FBAddr + BankNumHigh + PhysicalAdrHigh) =3D=3D PhysicalAdrHigh) return 1; } =20 @@ -6155,24 +6167,20 @@ static int sisfb_probe(struct pci_dev *pdev, const = struct pci_device_id *ent) #endif =20 #ifdef CONFIG_FB_SIS_315 - if(ivideo->sisvga_engine =3D=3D SIS_315_VGA) { + if (ivideo->sisvga_engine =3D=3D SIS_315_VGA) { int result =3D 1; - /* if((ivideo->chip =3D=3D SIS_315H) || - (ivideo->chip =3D=3D SIS_315) || - (ivideo->chip =3D=3D SIS_315PRO) || - (ivideo->chip =3D=3D SIS_330)) { - sisfb_post_sis315330(pdev); - } else */ if(ivideo->chip =3D=3D XGI_20) { + + if (ivideo->chip =3D=3D XGI_20) { result =3D sisfb_post_xgi(pdev); ivideo->sisfb_can_post =3D 1; - } else if((ivideo->chip =3D=3D XGI_40) && ivideo->haveXGIROM) { + } else if ((ivideo->chip =3D=3D XGI_40) && ivideo->haveXGIROM) { result =3D sisfb_post_xgi(pdev); ivideo->sisfb_can_post =3D 1; } else { printk(KERN_INFO "sisfb: Card is not " "POSTed and sisfb can't do this either.\n"); } - if(!result) { + if (!result) { printk(KERN_ERR "sisfb: Failed to POST card\n"); ret =3D -ENODEV; goto error_3; --=20 2.20.1.7.g153144c