diff mbox

[2/7] video: fbdev: intelfb: delete double assignment

Message ID 1408818808-18850-3-git-send-email-Julia.Lawall@lip6.fr (mailing list archive)
State New, archived
Headers show

Commit Message

Julia Lawall Aug. 23, 2014, 6:33 p.m. UTC
From: Julia Lawall <Julia.Lawall@lip6.fr>

Delete successive assignments to the same location.

In the second case, = is converted to |=, which looks appropriate based on
the values involved.

A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)

// <smpl>
@@
expression i;
@@

*i = ...;
 i = ...;
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

---
The patches in this series do not depend on each other.

This changes the behavior of the code in the second case and is not tested.

 drivers/video/fbdev/intelfb/intelfbhw.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)


--
To unsubscribe from this list: send the line "unsubscribe linux-fbdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Tomi Valkeinen Aug. 26, 2014, 10:56 a.m. UTC | #1
On 23/08/14 21:33, Julia Lawall wrote:
> From: Julia Lawall <Julia.Lawall@lip6.fr>
> 
> Delete successive assignments to the same location.
> 
> In the second case, = is converted to |=, which looks appropriate based on
> the values involved.
> 
> A simplified version of the semantic match that finds this problem is as
> follows: (http://coccinelle.lip6.fr/)
> 
> // <smpl>
> @@
> expression i;
> @@
> 
> *i = ...;
>  i = ...;
> // </smpl>
> 
> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
> 
> ---
> The patches in this series do not depend on each other.
> 
> This changes the behavior of the code in the second case and is not tested.

In this patch, as in the sis one, the behavior is changed. The subject
might perhaps be "fix cursor initialization"?

The patch does look like it could cause a regression, though. Anyone
able to test this?

 Tomi

> 
>  drivers/video/fbdev/intelfb/intelfbhw.c |    3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/video/fbdev/intelfb/intelfbhw.c b/drivers/video/fbdev/intelfb/intelfbhw.c
> index fbad61d..d31ed4e 100644
> --- a/drivers/video/fbdev/intelfb/intelfbhw.c
> +++ b/drivers/video/fbdev/intelfb/intelfbhw.c
> @@ -1191,7 +1191,6 @@ int intelfbhw_mode_to_hw(struct intelfb_info *dinfo,
>  	vsync_end = vsync_start + var->vsync_len;
>  	vtotal = vsync_end + var->upper_margin;
>  	vblank_start = vactive;
> -	vblank_end = vtotal;
>  	vblank_end = vsync_end + 1;
>  
>  	DBG_MSG("V: act %d, ss %d, se %d, tot %d bs %d, be %d\n",
> @@ -1859,7 +1858,7 @@ void intelfbhw_cursor_init(struct intelfb_info *dinfo)
>  		tmp = INREG(CURSOR_CONTROL);
>  		tmp &= ~(CURSOR_FORMAT_MASK | CURSOR_GAMMA_ENABLE |
>  			 CURSOR_ENABLE | CURSOR_STRIDE_MASK);
> -		tmp = CURSOR_FORMAT_3C;
> +		tmp |= CURSOR_FORMAT_3C;
>  		OUTREG(CURSOR_CONTROL, tmp);
>  		OUTREG(CURSOR_A_BASEADDR, dinfo->cursor.offset << 12);
>  		tmp = (64 << CURSOR_SIZE_H_SHIFT) |
>
diff mbox

Patch

diff --git a/drivers/video/fbdev/intelfb/intelfbhw.c b/drivers/video/fbdev/intelfb/intelfbhw.c
index fbad61d..d31ed4e 100644
--- a/drivers/video/fbdev/intelfb/intelfbhw.c
+++ b/drivers/video/fbdev/intelfb/intelfbhw.c
@@ -1191,7 +1191,6 @@  int intelfbhw_mode_to_hw(struct intelfb_info *dinfo,
 	vsync_end = vsync_start + var->vsync_len;
 	vtotal = vsync_end + var->upper_margin;
 	vblank_start = vactive;
-	vblank_end = vtotal;
 	vblank_end = vsync_end + 1;
 
 	DBG_MSG("V: act %d, ss %d, se %d, tot %d bs %d, be %d\n",
@@ -1859,7 +1858,7 @@  void intelfbhw_cursor_init(struct intelfb_info *dinfo)
 		tmp = INREG(CURSOR_CONTROL);
 		tmp &= ~(CURSOR_FORMAT_MASK | CURSOR_GAMMA_ENABLE |
 			 CURSOR_ENABLE | CURSOR_STRIDE_MASK);
-		tmp = CURSOR_FORMAT_3C;
+		tmp |= CURSOR_FORMAT_3C;
 		OUTREG(CURSOR_CONTROL, tmp);
 		OUTREG(CURSOR_A_BASEADDR, dinfo->cursor.offset << 12);
 		tmp = (64 << CURSOR_SIZE_H_SHIFT) |