Skip to contentSkip to conversation

Staging: rtl8188eu: Remove unnecessary variable

PATCH Superseded Vatika Harlalka 3 participants 4 messages Feb 23, 2015 Staging

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Staging: rtl8188eu: Remove unnecessary variable

Remove unnecessary variable and replace its uses with previously defined variable.

---
 drivers/staging/rtl8188eu/hal/phy.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/staging/rtl8188eu/hal/phy.c +2 -3
index 623fb4f..341f0db 100644
@@ -117,10 +117,9 @@ static void rf_serial_write(struct adapter *adapt,
 	u32 data_and_addr = 0;
 	struct hal_data_8188e *hal_data = GET_HAL_DATA(adapt);
 	struct bb_reg_def *phyreg = &hal_data->PHYRegDef[rfpath];
-	u32 newoffset;
 
-	newoffset = offset & 0xff;
-	data_and_addr = ((newoffset<<20) | (data&0x000fffff)) & 0x0fffffff;
+	offset &= 0xff;
+	data_and_addr = ((offset<<20) | (data&0x000fffff)) & 0x0fffffff;
 	phy_set_bb_reg(adapt, phyreg->rf3wireOffset, bMaskDWord, data_and_addr);
 }
 
Signature · 1 line
1.9.1
#1 lore raw
Quoted 2 lines · Vatika Harlalka

Remove unnecessary variable and replace its uses with previously defined variable.

Hi Vatika,

A good commit message should always try to explain why the change is needed. In this case you could say:

We only need the last 8 bits from offset, so we can directly operate on offset variable
instead of introducing unneeded newoffset.

Other than that the code looks good to me.

Thanks,
Daniel.

#2 lore raw
Quoted 5 lines · Daniel Baluta
Quoted 2 lines · Vatika Harlalka

Remove unnecessary variable and replace its uses with previously defined variable.

Quoted 8 lines

Hi Vatika,

A good commit message should always try to explain why the change is needed. In this case you could say:

We only need the last 8 bits from offset, so we can directly operate on offset variable
instead of introducing unneeded newoffset.

How is the number of bits used relevant? They are both u32 variables.

thanks,
julia

#3 lore raw
Quoted 9 lines · Julia Lawall
Quoted 7 lines · Daniel Baluta
Quoted 2 lines · Vatika Harlalka

Remove unnecessary variable and replace its uses with previously defined variable.

Hi Vatika,

Quoted 8 lines
Quoted 6 lines

A good commit message should always try to explain why the change is needed. In this case you could say:

We only need the last 8 bits from offset, so we can directly operate on offset variable
instead of introducing unneeded newoffset.

How is the number of bits used relevant? They are both u32 variables.

Used as in useful.

Doing:

newoffset = offset & 0xff;

we only care about last 8 bits of offset.

Daniel.