diff mbox series

[v2,09/28] video: fbdev: sis: Fix set but not used warnings in init.c

Message ID 20201128224114.1033617-10-sam@ravnborg.org (mailing list archive)
State Superseded, archived
Headers show
Series drivers/video: W=1 warning fixes | expand

Commit Message

Sam Ravnborg Nov. 28, 2020, 10:40 p.m. UTC
Fix set bit not used warnings by removing the code the assign the
variables and the definition of the variables.
A register read is kept as it may have unknown side-effects.

This removes a lot of unused code - which is always a good thing to do.

v2:
  - Updated subject (Lee)

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Thomas Winischhofer <thomas@winischhofer.net>
Cc: Lee Jones <lee.jones@linaro.org>
---
 drivers/video/fbdev/sis/init.c | 34 ++++++----------------------------
 1 file changed, 6 insertions(+), 28 deletions(-)

Comments

Thomas Zimmermann Nov. 30, 2020, 9:16 a.m. UTC | #1
Am 28.11.20 um 23:40 schrieb Sam Ravnborg:
> Fix set bit not used warnings by removing the code the assign the

s/bit/but

Actually, I think the correct way of writing this would be with dashes:

Fix set-but-not-used warnings

In the current sentence, you're setting a 'but not used variable.'

> variables and the definition of the variables.
> A register read is kept as it may have unknown side-effects.
> 
> This removes a lot of unused code - which is always a good thing to do.
> 
> v2:
>    - Updated subject (Lee)
> 
> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
> Cc: Thomas Winischhofer <thomas@winischhofer.net>
> Cc: Lee Jones <lee.jones@linaro.org>

Acked-by: Thomas Zimmermann <tzimmermann@suse.de>

> ---
>   drivers/video/fbdev/sis/init.c | 34 ++++++----------------------------
>   1 file changed, 6 insertions(+), 28 deletions(-)
> 
> diff --git a/drivers/video/fbdev/sis/init.c b/drivers/video/fbdev/sis/init.c
> index fde27feae5d0..b77ea1a8825a 100644
> --- a/drivers/video/fbdev/sis/init.c
> +++ b/drivers/video/fbdev/sis/init.c
> @@ -2648,7 +2648,7 @@ static void
>   SiS_SetCRT1ModeRegs(struct SiS_Private *SiS_Pr, unsigned short ModeNo,
>   		unsigned short ModeIdIndex, unsigned short RRTI)
>   {
> -   unsigned short data, infoflag = 0, modeflag, resindex;
> +   unsigned short data, infoflag = 0, modeflag;
>   #ifdef CONFIG_FB_SIS_315
>      unsigned char  *ROMAddr  = SiS_Pr->VirtualRomBase;
>      unsigned short data2, data3;
> @@ -2659,7 +2659,7 @@ SiS_SetCRT1ModeRegs(struct SiS_Private *SiS_Pr, unsigned short ModeNo,
>      if(SiS_Pr->UseCustomMode) {
>         infoflag = SiS_Pr->CInfoFlag;
>      } else {
> -      resindex = SiS_GetResInfo(SiS_Pr, ModeNo, ModeIdIndex);
> +      SiS_GetResInfo(SiS_Pr, ModeNo, ModeIdIndex);
>         if(ModeNo > 0x13) {
>   	 infoflag = SiS_Pr->SiS_RefIndex[RRTI].Ext_InfoFlag;
>         }
> @@ -3538,17 +3538,13 @@ SiS_Generic_ConvertCRData(struct SiS_Private *SiS_Pr, unsigned char *crdata,
>   			struct fb_var_screeninfo *var, bool writeres
>   )
>   {
> -   unsigned short HRE, HBE, HRS, HBS, HDE, HT;
> -   unsigned short VRE, VBE, VRS, VBS, VDE, VT;
> -   unsigned char  sr_data, cr_data, cr_data2;
> -   int            A, B, C, D, E, F, temp;
> +   unsigned short HRE, HBE, HRS, HDE;
> +   unsigned short VRE, VBE, VRS, VDE;
> +   unsigned char  sr_data, cr_data;
> +   int            B, C, D, E, F, temp;
>   
>      sr_data = crdata[14];
>   
> -   /* Horizontal total */
> -   HT =  crdata[0] | ((unsigned short)(sr_data & 0x03) << 8);
> -   A = HT + 5;
> -
>      /* Horizontal display enable end */
>      HDE = crdata[1] | ((unsigned short)(sr_data & 0x0C) << 6);
>      E = HDE + 1;
> @@ -3557,9 +3553,6 @@ SiS_Generic_ConvertCRData(struct SiS_Private *SiS_Pr, unsigned char *crdata,
>      HRS = crdata[4] | ((unsigned short)(sr_data & 0xC0) << 2);
>      F = HRS - E - 3;
>   
> -   /* Horizontal blank start */
> -   HBS = crdata[2] | ((unsigned short)(sr_data & 0x30) << 4);
> -
>      sr_data = crdata[15];
>      cr_data = crdata[5];
>   
> @@ -3588,13 +3581,6 @@ SiS_Generic_ConvertCRData(struct SiS_Private *SiS_Pr, unsigned char *crdata,
>      sr_data = crdata[13];
>      cr_data = crdata[7];
>   
> -   /* Vertical total */
> -   VT  = crdata[6] |
> -	 ((unsigned short)(cr_data & 0x01) << 8) |
> -	 ((unsigned short)(cr_data & 0x20) << 4) |
> -	 ((unsigned short)(sr_data & 0x01) << 10);
> -   A = VT + 2;
> -
>      /* Vertical display enable end */
>      VDE = crdata[10] |
>   	 ((unsigned short)(cr_data & 0x02) << 7) |
> @@ -3609,14 +3595,6 @@ SiS_Generic_ConvertCRData(struct SiS_Private *SiS_Pr, unsigned char *crdata,
>   	 ((unsigned short)(sr_data & 0x08) << 7);
>      F = VRS + 1 - E;
>   
> -   cr_data2 = (crdata[16] & 0x01) << 5;
> -
> -   /* Vertical blank start */
> -   VBS = crdata[11] |
> -	 ((unsigned short)(cr_data  & 0x08) << 5) |
> -	 ((unsigned short)(cr_data2 & 0x20) << 4) |
> -	 ((unsigned short)(sr_data  & 0x04) << 8);
> -
>      /* Vertical blank end */
>      VBE = crdata[12] | ((unsigned short)(sr_data & 0x10) << 4);
>      temp = VBE - ((E - 1) & 511);
>
diff mbox series

Patch

diff --git a/drivers/video/fbdev/sis/init.c b/drivers/video/fbdev/sis/init.c
index fde27feae5d0..b77ea1a8825a 100644
--- a/drivers/video/fbdev/sis/init.c
+++ b/drivers/video/fbdev/sis/init.c
@@ -2648,7 +2648,7 @@  static void
 SiS_SetCRT1ModeRegs(struct SiS_Private *SiS_Pr, unsigned short ModeNo,
 		unsigned short ModeIdIndex, unsigned short RRTI)
 {
-   unsigned short data, infoflag = 0, modeflag, resindex;
+   unsigned short data, infoflag = 0, modeflag;
 #ifdef CONFIG_FB_SIS_315
    unsigned char  *ROMAddr  = SiS_Pr->VirtualRomBase;
    unsigned short data2, data3;
@@ -2659,7 +2659,7 @@  SiS_SetCRT1ModeRegs(struct SiS_Private *SiS_Pr, unsigned short ModeNo,
    if(SiS_Pr->UseCustomMode) {
       infoflag = SiS_Pr->CInfoFlag;
    } else {
-      resindex = SiS_GetResInfo(SiS_Pr, ModeNo, ModeIdIndex);
+      SiS_GetResInfo(SiS_Pr, ModeNo, ModeIdIndex);
       if(ModeNo > 0x13) {
 	 infoflag = SiS_Pr->SiS_RefIndex[RRTI].Ext_InfoFlag;
       }
@@ -3538,17 +3538,13 @@  SiS_Generic_ConvertCRData(struct SiS_Private *SiS_Pr, unsigned char *crdata,
 			struct fb_var_screeninfo *var, bool writeres
 )
 {
-   unsigned short HRE, HBE, HRS, HBS, HDE, HT;
-   unsigned short VRE, VBE, VRS, VBS, VDE, VT;
-   unsigned char  sr_data, cr_data, cr_data2;
-   int            A, B, C, D, E, F, temp;
+   unsigned short HRE, HBE, HRS, HDE;
+   unsigned short VRE, VBE, VRS, VDE;
+   unsigned char  sr_data, cr_data;
+   int            B, C, D, E, F, temp;
 
    sr_data = crdata[14];
 
-   /* Horizontal total */
-   HT =  crdata[0] | ((unsigned short)(sr_data & 0x03) << 8);
-   A = HT + 5;
-
    /* Horizontal display enable end */
    HDE = crdata[1] | ((unsigned short)(sr_data & 0x0C) << 6);
    E = HDE + 1;
@@ -3557,9 +3553,6 @@  SiS_Generic_ConvertCRData(struct SiS_Private *SiS_Pr, unsigned char *crdata,
    HRS = crdata[4] | ((unsigned short)(sr_data & 0xC0) << 2);
    F = HRS - E - 3;
 
-   /* Horizontal blank start */
-   HBS = crdata[2] | ((unsigned short)(sr_data & 0x30) << 4);
-
    sr_data = crdata[15];
    cr_data = crdata[5];
 
@@ -3588,13 +3581,6 @@  SiS_Generic_ConvertCRData(struct SiS_Private *SiS_Pr, unsigned char *crdata,
    sr_data = crdata[13];
    cr_data = crdata[7];
 
-   /* Vertical total */
-   VT  = crdata[6] |
-	 ((unsigned short)(cr_data & 0x01) << 8) |
-	 ((unsigned short)(cr_data & 0x20) << 4) |
-	 ((unsigned short)(sr_data & 0x01) << 10);
-   A = VT + 2;
-
    /* Vertical display enable end */
    VDE = crdata[10] |
 	 ((unsigned short)(cr_data & 0x02) << 7) |
@@ -3609,14 +3595,6 @@  SiS_Generic_ConvertCRData(struct SiS_Private *SiS_Pr, unsigned char *crdata,
 	 ((unsigned short)(sr_data & 0x08) << 7);
    F = VRS + 1 - E;
 
-   cr_data2 = (crdata[16] & 0x01) << 5;
-
-   /* Vertical blank start */
-   VBS = crdata[11] |
-	 ((unsigned short)(cr_data  & 0x08) << 5) |
-	 ((unsigned short)(cr_data2 & 0x20) << 4) |
-	 ((unsigned short)(sr_data  & 0x04) << 8);
-
    /* Vertical blank end */
    VBE = crdata[12] | ((unsigned short)(sr_data & 0x10) << 4);
    temp = VBE - ((E - 1) & 511);