* [Outreachy kernel] [PATCH] staging: rtlwifi: rtl8822be: compress two lines into one
@ 2019-03-29 14:58 Payal Kshirsagar
2019-03-29 16:19 ` Greg KH
0 siblings, 1 reply; 3+ messages in thread
From: Payal Kshirsagar @ 2019-03-29 14:58 UTC (permalink / raw)
To: outreachy-kernel; +Cc: 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;
@@
-ret = e;
+return e;
-return ret;
Signed-off-by: Payal Kshirsagar <payal.s.kshirsagar.98@gmail.com>
---
diff -u -p a/phy.c b/phy.c
--- a/phy.c
+++ b/phy.c
@@ -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(struc
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,
@@ -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(st
if (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);
}
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Outreachy kernel] [PATCH] staging: rtlwifi: rtl8822be: compress two lines into one
2019-03-29 14:58 [Outreachy kernel] [PATCH] staging: rtlwifi: rtl8822be: compress two lines into one Payal Kshirsagar
@ 2019-03-29 16:19 ` Greg KH
2019-03-29 17:15 ` Payal Kshirsagar
0 siblings, 1 reply; 3+ messages in thread
From: Greg KH @ 2019-03-29 16:19 UTC (permalink / raw)
To: Payal Kshirsagar; +Cc: outreachy-kernel
On Fri, Mar 29, 2019 at 08:28:39PM +0530, Payal Kshirsagar wrote:
> 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;
>
> Signed-off-by: Payal Kshirsagar <payal.s.kshirsagar.98@gmail.com>
> ---
> diff -u -p a/phy.c b/phy.c
> --- a/phy.c
> +++ b/phy.c
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Outreachy kernel] [PATCH] staging: rtlwifi: rtl8822be: compress two lines into one
2019-03-29 16:19 ` Greg KH
@ 2019-03-29 17:15 ` Payal Kshirsagar
0 siblings, 0 replies; 3+ messages in thread
From: Payal Kshirsagar @ 2019-03-29 17:15 UTC (permalink / raw)
To: Greg KH; +Cc: outreachy-kernel
[-- Attachment #1: Type: text/plain, Size: 1408 bytes --]
On Fri, Mar 29, 2019, 9:49 PM Greg KH <greg@kroah.com> wrote:
> On Fri, Mar 29, 2019 at 08:28:39PM +0530, Payal Kshirsagar wrote:
> > 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;
> >
> > Signed-off-by: Payal Kshirsagar <payal.s.kshirsagar.98@gmail.com>
> > ---
> > diff -u -p a/phy.c b/phy.c
> > --- a/phy.c
> > +++ b/phy.c
>
> 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 :)
>
Okay I will apply it on a root directory and will send it again.
Thanks,
Payal
thanks,
>
> 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 outreachy-kernel+unsubscribe@googlegroups.com.
> To post to this group, send email to outreachy-kernel@googlegroups.com.
> 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.
>
[-- Attachment #2: Type: text/html, Size: 2653 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-03-29 17:15 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-29 14:58 [Outreachy kernel] [PATCH] staging: rtlwifi: rtl8822be: compress two lines into one Payal Kshirsagar
2019-03-29 16:19 ` Greg KH
2019-03-29 17:15 ` Payal Kshirsagar
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.