Staging: rtl8188eu: Reindent code to reduce line size
PATCH v3 1/1 Staging: rtl8188eu: Reindent code to reduce line size
Reindent code to reduce line size and increase readability.
---
Changes in v3: Fixed spelling error in commit message.
Changes in v2: Changed subject line to imperative form ( "Reindented" to "Reindent" ).
drivers/staging/rtl8188eu/hal/bb_cfg.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/staging/rtl8188eu/hal/bb_cfg.c +4 -2
@@ -508,7 +508,8 @@ static u32 array_phy_reg_pg_8188e[] = { }; -static void store_pwrindex_offset (struct adapter *Adapter,u32 regaddr,u32 bitmask,u32 data) +static void store_pwrindex_offset (struct adapter *Adapter, +u32 regaddr,u32 bitmask,u32 data) {struct hal_data_8188e *hal_data =GET_HAL_DATA (Adapter);u8 pwrGrpCnt = hal_data->pwrGroupCnt;
@@ -553,7 +554,8 @@ static void store_pwrindex_offset(struct adapter *Adapter, u32 regaddr, u32 bitm } } -static void rtl_addr_delay (struct adapter *adapt,u32 addr,u32 bit_mask,u32 data) +static void rtl_addr_delay (struct adapter *adapt, +u32 addr,u32 bit_mask,u32 data) {if (addr ==0xfe )msleep (50 );
Signature · 1 line
1.9.1
Quoted 15 lines · Vatika Harlalka
Reindent code to reduce line size and increase readability.
Signed-off-by Vatika Harlalka <[email protected]>---
Changes in v3: Fixed spelling error in commit message.
Changes in v2: Changed subject line to imperative form ( "Reindented" to "Reindent" ).drivers/staging/rtl8188eu/hal/bb_cfg.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)drivers/staging/rtl8188eu/hal/bb_cfg.c +0
-0
drivers/staging/rtl8188eu/hal/bb_cfg.c static u32 array_phy_reg_pg_8188e[] = { · line 512
Quoted 6 lines
drivers/staging/rtl8188eu/hal/bb_cfg.c +2
-1@@ -508,7 +508,8 @@ static u32 array_phy_reg_pg_8188e[] = { }; -static void store_pwrindex_offset (struct adapter *Adapter,u32 regaddr,u32 bitmask,u32 data) +static void store_pwrindex_offset (struct adapter *Adapter, +u32 regaddr,u32 bitmask,u32 data)
You need to get the alignment right of you break up lines - the second line function arguments need to line up with the opening bracket of the function. This goes for both functions.
Once broken up, the above should look like this:
static void store_pwrindex_offset(struct adapter *Adapter,
u32 regaddr, u32 bitmask, u32 data)
Jes
Quoted 14 lines
drivers/staging/rtl8188eu/hal/bb_cfg.c +2
-1{struct hal_data_8188e *hal_data =GET_HAL_DATA (Adapter);u8 pwrGrpCnt = hal_data->pwrGroupCnt;@@ -553,7 +554,8 @@ static void store_pwrindex_offset(struct adapter *Adapter, u32 regaddr, u32 bitm } } -static void rtl_addr_delay (struct adapter *adapt,u32 addr,u32 bit_mask,u32 data) +static void rtl_addr_delay (struct adapter *adapt, +u32 addr,u32 bit_mask,u32 data) {if (addr ==0xfe )msleep (50 );
Quoted 15 lines · Vatika Harlalka
Reindent code to reduce line size and increase readability.
Signed-off-by Vatika Harlalka <[email protected]>---
Changes in v3: Fixed spelling error in commit message.
Changes in v2: Changed subject line to imperative form ( "Reindented" to "Reindent" ).drivers/staging/rtl8188eu/hal/bb_cfg.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)drivers/staging/rtl8188eu/hal/bb_cfg.c +0
-0
drivers/staging/rtl8188eu/hal/bb_cfg.c static u32 array_phy_reg_pg_8188e[] = { · line 515
Quoted 9 lines
drivers/staging/rtl8188eu/hal/bb_cfg.c +2
-1@@ -508,7 +508,8 @@ static u32 array_phy_reg_pg_8188e[] = { }; -static void store_pwrindex_offset (struct adapter *Adapter,u32 regaddr,u32 bitmask,u32 data) +static void store_pwrindex_offset (struct adapter *Adapter, +u32 regaddr,u32 bitmask,u32 data) {struct hal_data_8188e *hal_data =GET_HAL_DATA (Adapter);u8 pwrGrpCnt = hal_data->pwrGroupCnt;
It looks like you already started addressing the follow-on issue that I wanted to raise, but you didn't specify that this patch should go on top of another patch.
You shouldn't really use u8 for an index, it is better to use int, and if you pick a shorter name it will help breaking down the lines in the follow-on code. I would recommend doing something like this:
int idx = hal_data->pwrGroupCnt; if (regaddr == rTxAGC_A_Rate18_06) hal_data->MCSTxPowerLevelOriginalOffset[idx][0] = data;
..... do this for all users of hal_data->pwrGroupCnt in this function.
Cheers,
Jes
Quoted 11 lines
drivers/staging/rtl8188eu/hal/bb_cfg.c +2
-1@@ -553,7 +554,8 @@ static void store_pwrindex_offset(struct adapter *Adapter, u32 regaddr, u32 bitm } } -static void rtl_addr_delay (struct adapter *adapt,u32 addr,u32 bit_mask,u32 data) +static void rtl_addr_delay (struct adapter *adapt, +u32 addr,u32 bit_mask,u32 data) {if (addr ==0xfe )msleep (50 );
Hey, thanks for your response :)
I checked the definition for struct hal_data_8188e, where pwrGrpCnt is defined as u8.
will u8 to int casting not create any problems?