Staging: xgifb: Use shorthand operator
PATCH 1/1 Staging: xgifb: Use shorthand operator
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
)
--- drivers/staging/xgifb/vb_setmode.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/staging/xgifb/vb_setmode.c +6 -6
@@ -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; }
Signature · 1 line
1.9.1
Quoted 5 lines · 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;
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
Quoted 68 lines
@@
(
- data = data + x
+ data += x
|
- data = data - x
+ data -= x
)Signed-off-by Bhumika Goyal <[email protected]>--- drivers/staging/xgifb/vb_setmode.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)drivers/staging/xgifb/vb_setmode.c +6
-7@@ -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 [email protected]. To post to this group, send email to [email protected].
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.
Hey Julia ,
Is my approach for this script correct or it can further be simplified?
Thanks,
Bhumika
Greg KH
maintainerQuoted 25 lines · 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 <[email protected]>--- drivers/staging/xgifb/vb_setmode.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)drivers/staging/xgifb/vb_setmode.c +0
-0
drivers/staging/xgifb/vb_setmode.c static void XGI_SetCRT1Timing_H(struct vb_device_info *pVBInfo, · line 292
Quoted 5 lines
drivers/staging/xgifb/vb_setmode.c +1
-1@@ -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