staging: rtlwifi: rtl8822be: compress two lines into one
PATCH 1/1 staging: rtlwifi: rtl8822be: compress two lines into one
Challenge suggested by coccinelle.
Returning something from a function need not to be stored in a variable, can be return directly.
This patch compress two lines into one using following semantic patch:
@@
local idexpression ret;
expression e;
@@
-ret = e;
+return e;
-return ret;
---
phy.c +5 -13
@@ -219,10 +219,8 @@ bool rtl8822be_halmac_cb_init_bb_rf_regi txpath =RF_MASK_A |RF_MASK_B ; rxpath =RF_MASK_A |RF_MASK_B ; tx2path = false; - ret = rtlpriv->phydm.ops->phydm_trx_mode (rtlpriv, txpath, rxpath, - tx2path); - -return ret; +return rtlpriv->phydm.ops->phydm_trx_mode (rtlpriv, txpath, rxpath, + tx2path); }static void _rtl8822be_phy_init_tx_power_by_rate (struct ieee80211_hw *hw)
@@ -1580,11 +1578,7 @@ _rtl8822be_phy_get_txpower_by_rate(strucelse 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,
@@ -1858,8 +1852,7 @@ static long _rtl8822be_phy_txpwr_idx_to_ offset =-8 ;break ; } - pwrout_dbm = txpwridx /2 + offset; -return pwrout_dbm; +return txpwridx /2 + offset; }void rtl8822be_phy_scan_operation_backup (struct ieee80211_hw *hw,u8 operation)
@@ -2218,6 +2211,5 @@ bool rtl8822be_phy_set_rf_power_state(stif (rfpwr_state == ppsc->rfpwr_state)return bresult; - bresult =_rtl8822be_phy_set_rf_power_state (hw, rfpwr_state); -return bresult; +return _rtl8822be_phy_set_rf_power_state (hw, rfpwr_state); }
phy.c
Quoted 21 lines · Payal Kshirsagar
Challenge suggested by coccinelle.
Returning something from a function need not to be stored in a variable, can be return directly.
This patch compress two lines into one using following semantic patch:
@@
local idexpression ret;
expression e;
@@(quoted diff) +1
-2-ret = e; +return e; -return ret;Signed-off-by Payal Kshirsagar <[email protected]>---
diff -u -pa/phy.cb/phy.cphy.c +0
-0
Um, have you tried applying this? Your patches have to be able to be applied at the "root" of the kernel source tree, not buried in some random subdirectory :)
thanks,
greg k-h
Quoted 17 lines · Greg KH
Quoted 16 lines · Payal Kshirsagar
Challenge suggested by coccinelle.
Returning something from a function need not to be stored in a variable, can be return directly.
This patch compress two lines into one using following semantic patch:
@@
local idexpression ret;
expression e;
@@(quoted diff) +1
-2-ret = e; +return e; -return ret;
Quoted 10 lines
phy.c
Quoted 5 lines
Signed-off-by Payal Kshirsagar <[email protected]>---
diff -u -pa/phy.cb/phy.cphy.c +0
-0Um, have you tried applying this? Your patches have to be able to be applied at the "root" of the kernel source tree, not buried in some random subdirectory :)
Okay I will apply it on a root directory and will send it again. Thanks,
Payal
thanks,
Quoted 14 lines
greg k-h
--
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/20190329161930.GB26815%40kroah.com
.
For more options, visit https://groups.google.com/d/optout.