staging: rtlwifi: Compress two lines
v2 cover staging: rtlwifi: Compress two lines
This patchset:
-Compresses two lines into one line that is to return a value sometimes it need not be stored in temporary return variable and removes unnecessary variables.
Changes in v2:
-Subject line for patch number 6 and 7 made different.
Payal Kshirsagar (7):
staging: rtlwifi: Compress two lines into one line
staging: rtlwifi: phydm: phydm.c: Compress two lines into one line
staging: rtlwifi: phydm: phydm_rainfo.c: Compress two lines into one
line
staging: rtlwifi: btcoexist: Compress two lines into one line
staging: rtlwifi: halmac: halmac_88xx: Compress two lines into one
line
staging: rtlwifi: halmac: Compress two lines into one line
staging: rtlwifi: halmac: halmac_api.c: Compress two lines into one
line
drivers/staging/rtlwifi/btcoexist/halbtcoutsrc.c | 5 +---- .../rtlwifi/halmac/halmac_88xx/halmac_api_88xx_sdio.c | 5 +---- .../rtlwifi/halmac/halmac_88xx/halmac_api_88xx_usb.c | 5 +---- drivers/staging/rtlwifi/halmac/halmac_api.c | 7 ++----- drivers/staging/rtlwifi/phydm/phydm.c | 16 ++++------------ drivers/staging/rtlwifi/phydm/phydm_rainfo.c | 5 +---- drivers/staging/rtlwifi/rtl8822be/phy.c | 12 ++++-------- 7 files changed, 14 insertions(+), 41 deletions(-)
Signature · 1 line
2.7.4
PATCH v2 1/7 staging: rtlwifi: Compress two lines into one line
Challenge suggested by coccinelle.
Compresses two lines into one line and remove unnecessary variable.
--- drivers/staging/rtlwifi/rtl8822be/phy.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-)
drivers/staging/rtlwifi/rtl8822be/phy.c +4 -8
@@ -1566,13 +1566,12 @@ _rtl8822be_phy_get_txpower_by_rate(struct ieee80211_hw *hw, u8 band, u8 path,struct rtl_priv *rtlpriv =rtl_priv (hw);struct rtl_phy *rtlphy = &rtlpriv->phy;u8 tx_num; -char tx_pwr_diff =0 ;if (band !=BAND_ON_2_4G && band !=BAND_ON_5G ) -return tx_pwr_diff; +return 0 ;if (path >RF90_PATH_B ) -return tx_pwr_diff; +return 0 ;if ((rate >=DESC_RATEMCS8 && rate <=DESC_RATEMCS15 ) || (rate >=DESC_RATEVHT2SS_MCS0 && rate <=DESC_RATEVHT2SS_MCS9 ))
@@ -1580,11 +1579,8 @@ _rtl8822be_phy_get_txpower_by_rate(struct ieee80211_hw *hw, u8 band, u8 path,else tx_num =RF_1TX ; - tx_pwr_diff = (char )(rtlphy->tx_power_by_rate_offset[band][path][tx_num] - [rate] & -0xff ); - -return tx_pwr_diff; +return (char )(rtlphy->tx_power_by_rate_offset[band][path][tx_num] + [rate] &0xff ); } u8 rtl8822be_get_txpower_index(struct ieee80211_hw *hw, u8 path, u8 rate,
Signature · 1 line
2.7.4
Greg KH
maintainerRe: [Outreachy kernel] [PATCH v2 1/7] staging: rtlwifi: Compress two lines into one line
Quoted 7 lines · Payal Kshirsagar
Challenge suggested by coccinelle.
Compresses two lines into one line and remove unnecessary variable.Signed-off-by Payal Kshirsagar <[email protected]>--- drivers/staging/rtlwifi/rtl8822be/phy.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-)
This patch does not apply to my tree :(
PATCH v2 2/7 staging: rtlwifi: phydm: phydm.c: Compress two lines into one line
In reply to Payal KshirsagarChallenge suggested by coccinelle.
Compresses two lines into one line and remove unnecessary variables.
--- drivers/staging/rtlwifi/phydm/phydm.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-)
drivers/staging/rtlwifi/phydm/phydm.c +4 -12
@@ -49,7 +49,7 @@ static void odm_update_power_training_state(struct phy_dm_struct *dm);/*Y = 10*log(X)*/ s32 odm_pwdb_conversion (s32 X ,u32 total_bit,u32 decimal_bit) { -s32 Y , integer =0 , decimal =0 ; +s32 integer =0 , decimal =0 ;u32 i;if (X ==0 )
@@ -66,9 +66,7 @@ s32 odm_pwdb_conversion(s32 X, u32 total_bit, u32 decimal_bit) } } -Y =3 * (integer - decimal_bit) + decimal;/* 10*log(x)=3*log2(x), */ - -return Y ; +return 3 * (integer - decimal_bit) + decimal;/* 10*log(x)=3*log2(x), */ ; }s32 odm_sign_conversion (s32 value,u32 total_bit)
@@ -1240,7 +1238,6 @@ u32 odm_convert_to_db(u32 value) {u8 i;u8 j; -u32 dB; value = value &0xFFFF ;
@@ -1257,16 +1254,13 @@ u32 odm_convert_to_db(u32 value)break ; } - dB = (i <<3 ) + j +1 ; - -return dB; +return (i <<3 ) + j +1 ; }u32 odm_convert_to_linear (u32 value) {u8 i;u8 j; -u32 linear;/* 1dB~96dB */
@@ -1275,9 +1269,7 @@ u32 odm_convert_to_linear(u32 value) i = (u8)((value -1 ) >>3 ); j = (u8)(value -1 ) - (i <<3 ); - linear = db_invert_table[i][j]; - -return linear; +return db_invert_table[i][j]; }/*
Signature · 1 line
2.7.4
PATCH v2 3/7 staging: rtlwifi: phydm: phydm_rainfo.c: Compress two lines into one line
In reply to Payal KshirsagarChallenge suggested by coccinelle.
Compresses two lines into one line and remove unnecessary variable.
--- drivers/staging/rtlwifi/phydm/phydm_rainfo.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/staging/rtlwifi/phydm/phydm_rainfo.c +1 -4
@@ -926,8 +926,6 @@ void odm_refresh_basic_rate_mask(void *dm_void) {}u8 phydm_rate_order_compute (void *dm_void,u8 rate_idx) { -u8 rate_order =0 ; -if (rate_idx >=ODM_RATEVHTSS4MCS0 ) { rate_idx -=ODM_RATEVHTSS4MCS0 ;/**/
@@ -950,9 +948,8 @@ u8 phydm_rate_order_compute(void *dm_void, u8 rate_idx) rate_idx -=ODM_RATEMCS8 ;/**/ } - rate_order = rate_idx; -return rate_order; +return rate_idx; }static void phydm_ra_common_info_update (void *dm_void)
Signature · 1 line
2.7.4
PATCH v2 4/7 staging: rtlwifi: btcoexist: Compress two lines into one line
In reply to Payal KshirsagarChallenge suggested by coccinelle.
Compresses two lines into one line and remove unnecessary variable.
--- drivers/staging/rtlwifi/btcoexist/halbtcoutsrc.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/staging/rtlwifi/btcoexist/halbtcoutsrc.c +1 -4
@@ -456,7 +456,6 @@ static u32 halbtc_get_wifi_link_status(struct btc_coexist *btcoexist)*/ struct rtl_priv *rtlpriv = btcoexist->adapter;struct rtl_mac *mac =rtl_mac (rtlpriv); -u32 ret_val =0 ;u32 port_connected_status =0 , num_of_connected_port =0 ; if (mac->opmode == NL80211_IFTYPE_STATION &&
@@ -471,9 +470,7 @@ static u32 halbtc_get_wifi_link_status(struct btc_coexist *btcoexist) }/* TODO: P2P Connected Status */ - ret_val = (num_of_connected_port <<16 ) | port_connected_status; - -return ret_val; +return (num_of_connected_port <<16 ) | port_connected_status; }static bool halbtc_get (void *void_btcoexist,u8 get_type,void *out_buf)
Signature · 1 line
2.7.4
PATCH v2 5/7 staging: rtlwifi: halmac: halmac_88xx: Compress two lines into one line
In reply to Payal KshirsagarChallenge suggested by coccinelle.
Compresses two lines into one line and remove unnecessary variable.
--- drivers/staging/rtlwifi/halmac/halmac_88xx/halmac_api_88xx_sdio.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/staging/rtlwifi/halmac/halmac_88xx/halmac_api_88xx_sdio.c +1 -4
@@ -165,7 +165,6 @@ halmac_cfg_rx_aggregation_88xx_sdio(struct halmac_adapter *halmac_adapter,u8 halmac_reg_read_8_sdio_88xx (struct halmac_adapter *halmac_adapter,u32 halmac_offset) { -u8 value8;void *driver_adapter =NULL ;struct halmac_api *halmac_api;enum halmac_ret_status status =HALMAC_RET_SUCCESS ;
@@ -190,9 +189,7 @@ u8 halmac_reg_read_8_sdio_88xx(struct halmac_adapter *halmac_adapter,return status; } - value8 =PLATFORM_SDIO_CMD52_READ (driver_adapter, halmac_offset); - -return value8; +return PLATFORM_SDIO_CMD52_READ (driver_adapter, halmac_offset); }/**
Signature · 1 line
2.7.4
PATCH v2 6/7 staging: rtlwifi: halmac: Compress two lines into one line
In reply to Payal KshirsagarChallenge suggested by coccinelle.
Compresses two lines into one line and remove unnecessary variable.
--- drivers/staging/rtlwifi/halmac/halmac_88xx/halmac_api_88xx_usb.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/staging/rtlwifi/halmac/halmac_88xx/halmac_api_88xx_usb.c +1 -4
@@ -192,7 +192,6 @@ halmac_cfg_rx_aggregation_88xx_usb(struct halmac_adapter *halmac_adapter,u8 halmac_reg_read_8_usb_88xx (struct halmac_adapter *halmac_adapter,u32 halmac_offset) { -u8 value8;void *driver_adapter =NULL ;struct halmac_api *halmac_api;
@@ -205,9 +204,7 @@ u8 halmac_reg_read_8_usb_88xx(struct halmac_adapter *halmac_adapter, driver_adapter = halmac_adapter->driver_adapter; halmac_api = (struct halmac_api *)halmac_adapter->halmac_api; - value8 =PLATFORM_REG_READ_8 (driver_adapter, halmac_offset); - -return value8; +return PLATFORM_REG_READ_8 (driver_adapter, halmac_offset); }/**
Signature · 1 line
2.7.4
PATCH v2 7/7 staging: rtlwifi: halmac: halmac_api.c: Compress two lines into one line
In reply to Payal KshirsagarChallenge suggested by coccinelle.
Compresses two lines into one line and remove unnecessary variable.
--- drivers/staging/rtlwifi/halmac/halmac_api.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/staging/rtlwifi/halmac/halmac_api.c +2 -5
@@ -133,7 +133,6 @@ platform_reg_read_8_sdio(void *driver_adapter, struct halmac_platform_api *halmac_platform_api, u32 offset) { -u8 value8;u32 halmac_offset = offset;enum halmac_ret_status status =HALMAC_RET_SUCCESS ;
@@ -146,10 +145,8 @@ platform_reg_read_8_sdio(void *driver_adapter,return status; } - value8 = halmac_platform_api->SDIO_CMD52_READ (driver_adapter, - halmac_offset); - -return value8; +return halmac_platform_api->SDIO_CMD52_READ (driver_adapter, + halmac_offset); } static enum halmac_ret_status
Signature · 1 line
2.7.4