diff mbox series

[v2,06/28] video: fbdev: aty: Fix set but not used warnings in mach64_ct

Message ID 20201128224114.1033617-7-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 W=1 warnings about variables assigned but never used.
- One variable is only used when CONFIG_FB_ATY_GENERIC_LCD is defined
  Fix so variable is only defined with CONFIG_FB_ATY_GENERIC_LCD
- Several variables was only assigned by a call to aty_ld_le32().
  Drop the variables but keep the call to aty_ld_le32() as it may
  have unexpected side-effects.

v2:
  - Updated subject (Lee)

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Lee Jones <lee.jones@linaro.org>
---
 drivers/video/fbdev/aty/mach64_ct.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

Comments

Thomas Zimmermann Nov. 30, 2020, 8:57 a.m. UTC | #1
Am 28.11.20 um 23:40 schrieb Sam Ravnborg:
> Fix W=1 warnings about variables assigned but never used.
> - One variable is only used when CONFIG_FB_ATY_GENERIC_LCD is defined
>    Fix so variable is only defined with CONFIG_FB_ATY_GENERIC_LCD
> - Several variables was only assigned by a call to aty_ld_le32().
>    Drop the variables but keep the call to aty_ld_le32() as it may
>    have unexpected side-effects.
> 
> v2:
>    - Updated subject (Lee)
> 
> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
> Cc: Lee Jones <lee.jones@linaro.org>

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

> ---
>   drivers/video/fbdev/aty/mach64_ct.c | 15 +++++++++------
>   1 file changed, 9 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/video/fbdev/aty/mach64_ct.c b/drivers/video/fbdev/aty/mach64_ct.c
> index f87cc81f4fa2..011b07e44e0d 100644
> --- a/drivers/video/fbdev/aty/mach64_ct.c
> +++ b/drivers/video/fbdev/aty/mach64_ct.c
> @@ -281,10 +281,13 @@ static u32 aty_pll_to_var_ct(const struct fb_info *info, const union aty_pll *pl
>   void aty_set_pll_ct(const struct fb_info *info, const union aty_pll *pll)
>   {
>   	struct atyfb_par *par = (struct atyfb_par *) info->par;
> -	u32 crtc_gen_cntl, lcd_gen_cntrl;
> +	u32 crtc_gen_cntl;
>   	u8 tmp, tmp2;
>   
> -	lcd_gen_cntrl = 0;
> +#ifdef CONFIG_FB_ATY_GENERIC_LCD
> +	u32 lcd_gen_cntrl = 0;
> +#endif
> +
>   #ifdef DEBUG
>   	printk("atyfb(%s): about to program:\n"
>   		"pll_ext_cntl=0x%02x pll_gen_cntl=0x%02x pll_vclk_cntl=0x%02x\n",
> @@ -402,7 +405,7 @@ static int aty_init_pll_ct(const struct fb_info *info, union aty_pll *pll)
>   	struct atyfb_par *par = (struct atyfb_par *) info->par;
>   	u8 mpost_div, xpost_div, sclk_post_div_real;
>   	u32 q, memcntl, trp;
> -	u32 dsp_config, dsp_on_off, vga_dsp_config, vga_dsp_on_off;
> +	u32 dsp_config;
>   #ifdef DEBUG
>   	int pllmclk, pllsclk;
>   #endif
> @@ -488,9 +491,9 @@ static int aty_init_pll_ct(const struct fb_info *info, union aty_pll *pll)
>   
>   	/* Allow BIOS to override */
>   	dsp_config = aty_ld_le32(DSP_CONFIG, par);
> -	dsp_on_off = aty_ld_le32(DSP_ON_OFF, par);
> -	vga_dsp_config = aty_ld_le32(VGA_DSP_CONFIG, par);
> -	vga_dsp_on_off = aty_ld_le32(VGA_DSP_ON_OFF, par);
> +	aty_ld_le32(DSP_ON_OFF, par);
> +	aty_ld_le32(VGA_DSP_CONFIG, par);
> +	aty_ld_le32(VGA_DSP_ON_OFF, par);
>   
>   	if (dsp_config)
>   		pll->ct.dsp_loop_latency = (dsp_config & DSP_LOOP_LATENCY) >> 16;
>
diff mbox series

Patch

diff --git a/drivers/video/fbdev/aty/mach64_ct.c b/drivers/video/fbdev/aty/mach64_ct.c
index f87cc81f4fa2..011b07e44e0d 100644
--- a/drivers/video/fbdev/aty/mach64_ct.c
+++ b/drivers/video/fbdev/aty/mach64_ct.c
@@ -281,10 +281,13 @@  static u32 aty_pll_to_var_ct(const struct fb_info *info, const union aty_pll *pl
 void aty_set_pll_ct(const struct fb_info *info, const union aty_pll *pll)
 {
 	struct atyfb_par *par = (struct atyfb_par *) info->par;
-	u32 crtc_gen_cntl, lcd_gen_cntrl;
+	u32 crtc_gen_cntl;
 	u8 tmp, tmp2;
 
-	lcd_gen_cntrl = 0;
+#ifdef CONFIG_FB_ATY_GENERIC_LCD
+	u32 lcd_gen_cntrl = 0;
+#endif
+
 #ifdef DEBUG
 	printk("atyfb(%s): about to program:\n"
 		"pll_ext_cntl=0x%02x pll_gen_cntl=0x%02x pll_vclk_cntl=0x%02x\n",
@@ -402,7 +405,7 @@  static int aty_init_pll_ct(const struct fb_info *info, union aty_pll *pll)
 	struct atyfb_par *par = (struct atyfb_par *) info->par;
 	u8 mpost_div, xpost_div, sclk_post_div_real;
 	u32 q, memcntl, trp;
-	u32 dsp_config, dsp_on_off, vga_dsp_config, vga_dsp_on_off;
+	u32 dsp_config;
 #ifdef DEBUG
 	int pllmclk, pllsclk;
 #endif
@@ -488,9 +491,9 @@  static int aty_init_pll_ct(const struct fb_info *info, union aty_pll *pll)
 
 	/* Allow BIOS to override */
 	dsp_config = aty_ld_le32(DSP_CONFIG, par);
-	dsp_on_off = aty_ld_le32(DSP_ON_OFF, par);
-	vga_dsp_config = aty_ld_le32(VGA_DSP_CONFIG, par);
-	vga_dsp_on_off = aty_ld_le32(VGA_DSP_ON_OFF, par);
+	aty_ld_le32(DSP_ON_OFF, par);
+	aty_ld_le32(VGA_DSP_CONFIG, par);
+	aty_ld_le32(VGA_DSP_ON_OFF, par);
 
 	if (dsp_config)
 		pll->ct.dsp_loop_latency = (dsp_config & DSP_LOOP_LATENCY) >> 16;