All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Staging: xgifb: Use shorthand operator
@ 2016-02-09 15:55 Bhumika Goyal
  2016-02-09 15:58 ` [Outreachy kernel] " Julia Lawall
  2016-02-12  3:48 ` Greg KH
  0 siblings, 2 replies; 4+ messages in thread
From: Bhumika Goyal @ 2016-02-09 15:55 UTC (permalink / raw)
  To: outreachy-kernel; +Cc: Bhumika Goyal

Use shorthand operator for assignment statement to make code look cleaner.
Made a coccinelle script for this and did changes.
@@
identifier data;
constant x;
@@

(
- data = data + x
+ data += x
|
- data = data - x
+ data -= x
)

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
---
 drivers/staging/xgifb/vb_setmode.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/xgifb/vb_setmode.c b/drivers/staging/xgifb/vb_setmode.c
index de96da1..0daa661 100644
--- a/drivers/staging/xgifb/vb_setmode.c
+++ b/drivers/staging/xgifb/vb_setmode.c
@@ -289,7 +289,7 @@ static void XGI_SetCRT1Timing_H(struct vb_device_info *pVBInfo,
 
 	if (HwDeviceExtension->jChipType >= XG20) {
 		data = xgifb_reg_get(pVBInfo->P3d4, 0x04);
-		data = data - 1;
+		data -= 1;
 		xgifb_reg_set(pVBInfo->P3d4, 0x04, data);
 		data = xgifb_reg_get(pVBInfo->P3d4, 0x05);
 		data1 = data;
@@ -302,14 +302,14 @@ static void XGI_SetCRT1Timing_H(struct vb_device_info *pVBInfo,
 			xgifb_reg_set(pVBInfo->P3c4, 0x0c, data);
 			data = pushax;
 		}
-		data = data - 1;
+		data -= 1;
 		data |= data1;
 		xgifb_reg_set(pVBInfo->P3d4, 0x05, data);
 		data = xgifb_reg_get(pVBInfo->P3c4, 0x0e);
 		data >>= 5;
-		data = data + 3;
+		data += 3;
 		if (data > 7)
-			data = data - 7;
+			data -= 7;
 		data <<= 5;
 		xgifb_reg_and_or(pVBInfo->P3c4, 0x0e, ~0xE0, data);
 	}
@@ -3394,9 +3394,9 @@ static void XGI_SetGroup2(unsigned short ModeNo, unsigned short ModeIdIndex,
 	xgifb_reg_and_or(pVBInfo->Part2Port, 0x25, 0x0F, temp);
 
 	tempbx = push2;
-	tempbx = tempbx + 8;
+	tempbx += 8;
 	if (pVBInfo->VBInfo & SetCRT2ToHiVision) {
-		tempbx = tempbx - 4;
+		tempbx -= 4;
 		tempcx = tempbx;
 	}
 
-- 
1.9.1



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [Outreachy kernel] [PATCH] Staging: xgifb: Use shorthand operator
  2016-02-09 15:55 [PATCH] Staging: xgifb: Use shorthand operator Bhumika Goyal
@ 2016-02-09 15:58 ` Julia Lawall
  2016-02-09 19:17   ` Bhumika Goyal
  2016-02-12  3:48 ` Greg KH
  1 sibling, 1 reply; 4+ messages in thread
From: Julia Lawall @ 2016-02-09 15:58 UTC (permalink / raw)
  To: Bhumika Goyal; +Cc: outreachy-kernel

On Tue, 9 Feb 2016, Bhumika Goyal wrote:

> Use shorthand operator for assignment statement to make code look cleaner.
> Made a coccinelle script for this and did changes.
> @@
> identifier data;
> constant x;

I don't think that the constant constraint is technically necessary.  But
perhaps it is the case in which the simplification does seem useful.

julia

> @@
>
> (
> - data = data + x
> + data += x
> |
> - data = data - x
> + data -= x
> )
>
> Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
> ---
>  drivers/staging/xgifb/vb_setmode.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/staging/xgifb/vb_setmode.c b/drivers/staging/xgifb/vb_setmode.c
> index de96da1..0daa661 100644
> --- a/drivers/staging/xgifb/vb_setmode.c
> +++ b/drivers/staging/xgifb/vb_setmode.c
> @@ -289,7 +289,7 @@ static void XGI_SetCRT1Timing_H(struct vb_device_info *pVBInfo,
>
>  	if (HwDeviceExtension->jChipType >= XG20) {
>  		data = xgifb_reg_get(pVBInfo->P3d4, 0x04);
> -		data = data - 1;
> +		data -= 1;
>  		xgifb_reg_set(pVBInfo->P3d4, 0x04, data);
>  		data = xgifb_reg_get(pVBInfo->P3d4, 0x05);
>  		data1 = data;
> @@ -302,14 +302,14 @@ static void XGI_SetCRT1Timing_H(struct vb_device_info *pVBInfo,
>  			xgifb_reg_set(pVBInfo->P3c4, 0x0c, data);
>  			data = pushax;
>  		}
> -		data = data - 1;
> +		data -= 1;
>  		data |= data1;
>  		xgifb_reg_set(pVBInfo->P3d4, 0x05, data);
>  		data = xgifb_reg_get(pVBInfo->P3c4, 0x0e);
>  		data >>= 5;
> -		data = data + 3;
> +		data += 3;
>  		if (data > 7)
> -			data = data - 7;
> +			data -= 7;
>  		data <<= 5;
>  		xgifb_reg_and_or(pVBInfo->P3c4, 0x0e, ~0xE0, data);
>  	}
> @@ -3394,9 +3394,9 @@ static void XGI_SetGroup2(unsigned short ModeNo, unsigned short ModeIdIndex,
>  	xgifb_reg_and_or(pVBInfo->Part2Port, 0x25, 0x0F, temp);
>
>  	tempbx = push2;
> -	tempbx = tempbx + 8;
> +	tempbx += 8;
>  	if (pVBInfo->VBInfo & SetCRT2ToHiVision) {
> -		tempbx = tempbx - 4;
> +		tempbx -= 4;
>  		tempcx = tempbx;
>  	}
>
> --
> 1.9.1
>
> --
> You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to outreachy-kernel+unsubscribe@googlegroups.com.
> To post to this group, send email to outreachy-kernel@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/1455033333-31657-1-git-send-email-bhumirks%40gmail.com.
> For more options, visit https://groups.google.com/d/optout.
>


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Outreachy kernel] [PATCH] Staging: xgifb: Use shorthand operator
  2016-02-09 15:58 ` [Outreachy kernel] " Julia Lawall
@ 2016-02-09 19:17   ` Bhumika Goyal
  0 siblings, 0 replies; 4+ messages in thread
From: Bhumika Goyal @ 2016-02-09 19:17 UTC (permalink / raw)
  To: outreachy-kernel; +Cc: bhumirks


[-- Attachment #1.1: Type: text/plain, Size: 102 bytes --]

Hey Julia ,
 Is my approach for this script correct or it can further be simplified?

Thanks,
Bhumika

[-- Attachment #1.2: Type: text/html, Size: 139 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Outreachy kernel] [PATCH] Staging: xgifb: Use shorthand operator
  2016-02-09 15:55 [PATCH] Staging: xgifb: Use shorthand operator Bhumika Goyal
  2016-02-09 15:58 ` [Outreachy kernel] " Julia Lawall
@ 2016-02-12  3:48 ` Greg KH
  1 sibling, 0 replies; 4+ messages in thread
From: Greg KH @ 2016-02-12  3:48 UTC (permalink / raw)
  To: Bhumika Goyal; +Cc: outreachy-kernel

On Tue, Feb 09, 2016 at 09:25:33PM +0530, Bhumika Goyal wrote:
> Use shorthand operator for assignment statement to make code look cleaner.
> Made a coccinelle script for this and did changes.
> @@
> identifier data;
> constant x;
> @@
> 
> (
> - data = data + x
> + data += x
> |
> - data = data - x
> + data -= x
> )
> 
> Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
> ---
>  drivers/staging/xgifb/vb_setmode.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/staging/xgifb/vb_setmode.c b/drivers/staging/xgifb/vb_setmode.c
> index de96da1..0daa661 100644
> --- a/drivers/staging/xgifb/vb_setmode.c
> +++ b/drivers/staging/xgifb/vb_setmode.c
> @@ -289,7 +289,7 @@ static void XGI_SetCRT1Timing_H(struct vb_device_info *pVBInfo,
>  
>  	if (HwDeviceExtension->jChipType >= XG20) {
>  		data = xgifb_reg_get(pVBInfo->P3d4, 0x04);
> -		data = data - 1;
> +		data -= 1;

Sorry, I'm not going to take these kinds of "cleanups" anymore, they
aren't doing much...

greg k-h


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-02-12  3:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-09 15:55 [PATCH] Staging: xgifb: Use shorthand operator Bhumika Goyal
2016-02-09 15:58 ` [Outreachy kernel] " Julia Lawall
2016-02-09 19:17   ` Bhumika Goyal
2016-02-12  3:48 ` Greg KH

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.