Skip to contentSkip to conversation

staging: rtlwifi: Unneeded function halbtc_get_wifi_rssi()

PATCH In review Bhanusree Pola 3 participants 4 messages Oct 22, 2018 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: rtlwifi: Unneeded function halbtc_get_wifi_rssi()

In the function halbtc_get_wifi_rssi:

if and else are functionally identical.
Unneeded return variable undec_sm_pwdb.
Function not needed and so assigned value rtlpriv->dm.undec_sm_pwdb where the function halbtc_get_wifi_rssi() is called.

---
 drivers/staging/rtlwifi/btcoexist/halbtcoutsrc.c | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)
drivers/staging/rtlwifi/btcoexist/halbtcoutsrc.c +1 -12
index 24e19ff..b519d18 100644
@@ -476,17 +476,6 @@ static u32 halbtc_get_wifi_link_status(struct btc_coexist *btcoexist)
 	return ret_val;
 }
 
-static s32 halbtc_get_wifi_rssi(struct rtl_priv *rtlpriv)
-{
-	int undec_sm_pwdb = 0;
-
-	if (rtlpriv->mac80211.link_state >= MAC80211_LINKED)
-		undec_sm_pwdb = rtlpriv->dm.undec_sm_pwdb;
-	else /* associated entry pwdb */
-		undec_sm_pwdb = rtlpriv->dm.undec_sm_pwdb;
-	return undec_sm_pwdb;
-}
-
 static bool halbtc_get(void *void_btcoexist, u8 get_type, void *out_buf)
 {
 	struct btc_coexist *btcoexist = (struct btc_coexist *)void_btcoexist;
@@ -585,7 +574,7 @@ static bool halbtc_get(void *void_btcoexist, u8 get_type, void *out_buf)
 		*bool_tmp = false;
 		break;
 	case BTC_GET_S4_WIFI_RSSI:
-		*s32_tmp = halbtc_get_wifi_rssi(rtlpriv);
+		*s32_tmp = rtlpriv->dm.undec_sm_pwdb;
 		break;
 	case BTC_GET_S4_HS_RSSI:
 		*s32_tmp = 0;
Signature · 1 line
2.7.4
#1 lore raw
Quoted 7 lines · Bhanusree Pola

In the function halbtc_get_wifi_rssi:

if and else are functionally identical.
Unneeded return variable undec_sm_pwdb.
Function not needed and so assigned value rtlpriv->dm.undec_sm_pwdb where the function halbtc_get_wifi_rssi() is called.

Hi Bhanusree,

The subject line is not clear here. It should be something like 'Remove unneeded function ... '. Always write what patch is doing rather than just mentioning keywords.

Similarly for the commit log, I feel that it can improved a bit with have proper sentences and structure. Probably something like:

'In function x, <insert_reason_one> and <insert_reason_two>. So, function is not needed. And then <insert_what_patch_is_doing>.

Quoted 45 lines
---
 drivers/staging/rtlwifi/btcoexist/halbtcoutsrc.c | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)
drivers/staging/rtlwifi/btcoexist/halbtcoutsrc.c +1 -13
index 24e19ff..b519d18 100644
@@ -476,17 +476,6 @@ static u32 halbtc_get_wifi_link_status(struct btc_coexist *btcoexist)
        return ret_val;
 }
 
-static s32 halbtc_get_wifi_rssi(struct rtl_priv *rtlpriv)
-{
-       int undec_sm_pwdb = 0;
-
-       if (rtlpriv->mac80211.link_state >= MAC80211_LINKED)
-               undec_sm_pwdb = rtlpriv->dm.undec_sm_pwdb;
-       else /* associated entry pwdb */
-               undec_sm_pwdb = rtlpriv->dm.undec_sm_pwdb;
-       return undec_sm_pwdb;
-}
-
 static bool halbtc_get(void *void_btcoexist, u8 get_type, void *out_buf)
 {
        struct btc_coexist *btcoexist = (struct btc_coexist *)void_btcoexist;
@@ -585,7 +574,7 @@ static bool halbtc_get(void *void_btcoexist, u8 get_type, void *out_buf)
                *bool_tmp = false;
                break;
        case BTC_GET_S4_WIFI_RSSI:
-               *s32_tmp = halbtc_get_wifi_rssi(rtlpriv);
+               *s32_tmp = rtlpriv->dm.undec_sm_pwdb;
                break;
        case BTC_GET_S4_HS_RSSI:
                *s32_tmp = 0;
--

2.7.4

--
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/20181022102752.GA12423%40aakashd-VirtualBox.
For more options, visit https://groups.google.com/d/optout.

#2 lore raw

Ok, will do that. As I was asked to be imperative I did not elaborate the commit log. Will change it and send.

Bhanusree

Quoted 76 lines · On Mon, 22 Oct 2018 19:32 Vaishali Thakkar, <[email protected]> wrote:
Quoted 7 lines · Bhanusree Pola

In the function halbtc_get_wifi_rssi:

if and else are functionally identical.
Unneeded return variable undec_sm_pwdb.
Function not needed and so assigned value rtlpriv->dm.undec_sm_pwdb where the function halbtc_get_wifi_rssi() is called.

Hi Bhanusree,

The subject line is not clear here. It should be something like 'Remove unneeded function ... '. Always write what patch is doing rather than just mentioning keywords.

Similarly for the commit log, I feel that it can improved a bit with have proper sentences and structure. Probably something like:

'In function x, <insert_reason_one> and <insert_reason_two>. So, function is not needed. And then <insert_what_patch_is_doing>.

Review

Quoted 6 lines
---
 drivers/staging/rtlwifi/btcoexist/halbtcoutsrc.c | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)
(quoted diff) +0 -0

b/drivers/staging/rtlwifi/btcoexist/halbtcoutsrc.c

drivers/staging/rtlwifi/btcoexist/halbtcoutsrc.c static u32 halbtc_get_wifi_link_status(struct

Quoted 4 lines

index 24e19ff..b519d18 100644

drivers/staging/rtlwifi/btcoexist/halbtcoutsrc.c +0 -0
@@ -476,17 +476,6 @@ static u32 halbtc_get_wifi_link_status(struct

btc_coexist *btcoexist)

Quoted 7 lines
drivers/staging/rtlwifi/btcoexist/halbtcoutsrc.c +0 -4
        return ret_val;
 }
 
-static s32 halbtc_get_wifi_rssi(struct rtl_priv *rtlpriv)
-{
-       int undec_sm_pwdb = 0;
-

drivers/staging/rtlwifi/btcoexist/halbtcoutsrc.c static u32 halbtc_get_wifi_link_status(struct btc_coexist *btcoexist)

Quoted 10 lines
drivers/staging/rtlwifi/btcoexist/halbtcoutsrc.c +0 -7
-       if (rtlpriv->mac80211.link_state >= MAC80211_LINKED)
-               undec_sm_pwdb = rtlpriv->dm.undec_sm_pwdb;
-       else /* associated entry pwdb */
-               undec_sm_pwdb = rtlpriv->dm.undec_sm_pwdb;
-       return undec_sm_pwdb;
-}
-
 static bool halbtc_get(void *void_btcoexist, u8 get_type, void *out_buf)
 {
        struct btc_coexist *btcoexist = (struct btc_coexist

*)void_btcoexist;

drivers/staging/rtlwifi/btcoexist/halbtcoutsrc.c static bool halbtc_get(void *void_btcoexist, u8

Quoted 1 line
drivers/staging/rtlwifi/btcoexist/halbtcoutsrc.c +0 -0
@@ -585,7 +574,7 @@ static bool halbtc_get(void *void_btcoexist, u8

get_type, void *out_buf)

Quoted 11 lines
drivers/staging/rtlwifi/btcoexist/halbtcoutsrc.c +1 -2
                *bool_tmp = false;
                break;
        case BTC_GET_S4_WIFI_RSSI:
-               *s32_tmp = halbtc_get_wifi_rssi(rtlpriv);
+               *s32_tmp = rtlpriv->dm.undec_sm_pwdb;
                break;
        case BTC_GET_S4_HS_RSSI:
                *s32_tmp = 0;
--

2.7.4

Quoted 2 lines

--
You received this message because you are subscribed to the Google

Groups "outreachy-kernel" group.

Quoted 1 line

To unsubscribe from this group and stop receiving emails from it, send

an email to [email protected].

Quoted 2 lines

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/20181022102752.GA12423%40aakashd-VirtualBox
.

Quoted 1 line

For more options, visit https://groups.google.com/d/optout.

#3 lore raw
Quoted 2 lines · Bhanusree Mahesh

Ok, will do that.  As I was asked to be imperative I did not elaborate the commit log. Will change it and send.

Remember not to top post as well :)

julia

Quoted 99 lines

Bhanusree

On Mon, 22 Oct 2018 19:32 Vaishali Thakkar, <[email protected]> wrote:

      On Mon, Oct 22, 2018 at 3:59 PM Bhanusree Pola
      <[email protected]> wrote:
      >
      > In the function halbtc_get_wifi_rssi:
      >
      > if and else are functionally identical.
      > Unneeded return variable undec_sm_pwdb.
      > Function not needed and so assigned value
      rtlpriv->dm.undec_sm_pwdb where
      > the function halbtc_get_wifi_rssi() is called.

      Hi Bhanusree,

      The subject line is not clear here. It should be something like
      'Remove unneeded function ... '. Always write what patch is
      doing rather than just mentioning keywords.

      Similarly for the commit log, I feel that it can improved a bit
      with
      have proper sentences and structure. Probably something like:

      'In function x, <insert_reason_one> and <insert_reason_two>.
      So, function is not needed. And then
      <insert_what_patch_is_doing>.

      > Signed-off-by: Bhanusree Pola <[email protected]>
      > ---
      >  drivers/staging/rtlwifi/btcoexist/halbtcoutsrc.c | 13
      +------------
      >  1 file changed, 1 insertion(+), 12 deletions(-)
      >
      > diff --git a/drivers/staging/rtlwifi/btcoexist/halbtcoutsrc.c
      b/drivers/staging/rtlwifi/btcoexist/halbtcoutsrc.c
      > index 24e19ff..b519d18 100644
      > --- a/drivers/staging/rtlwifi/btcoexist/halbtcoutsrc.c
      > +++ b/drivers/staging/rtlwifi/btcoexist/halbtcoutsrc.c
      > @@ -476,17 +476,6 @@ static u32
      halbtc_get_wifi_link_status(struct btc_coexist *btcoexist)
      >         return ret_val;
      >  }
      >
      > -static s32 halbtc_get_wifi_rssi(struct rtl_priv *rtlpriv)
      > -{
      > -       int undec_sm_pwdb = 0;
      > -
      > -       if (rtlpriv->mac80211.link_state >= MAC80211_LINKED)
      > -               undec_sm_pwdb = rtlpriv->dm.undec_sm_pwdb;
      > -       else /* associated entry pwdb */
      > -               undec_sm_pwdb = rtlpriv->dm.undec_sm_pwdb;
      > -       return undec_sm_pwdb;
      > -}
      > -
      >  static bool halbtc_get(void *void_btcoexist, u8 get_type,
      void *out_buf)
      >  {
      >         struct btc_coexist *btcoexist = (struct btc_coexist
      *)void_btcoexist;
      > @@ -585,7 +574,7 @@ static bool halbtc_get(void
      *void_btcoexist, u8 get_type, void *out_buf)
      >                 *bool_tmp = false;
      >                 break;
      >         case BTC_GET_S4_WIFI_RSSI:
      > -               *s32_tmp = halbtc_get_wifi_rssi(rtlpriv);
      > +               *s32_tmp = rtlpriv->dm.undec_sm_pwdb;
      >                 break;
      >         case BTC_GET_S4_HS_RSSI:
      >                 *s32_tmp = 0;
      > --
      > 2.7.4
      >
      > --
      > 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 visithttps://groups.google.com/d/msgid/outreachy-kernel/20181022102752.GA12423%4
      0aakashd-VirtualBox.
      > For more options, visit https://groups.google.com/d/optout.

--
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 visithttps://groups.google.com/d/msgid/outreachy-kernel/CAB0Mk-NsLvS5fn8Hi58G1Y4 ykVRquWqp1ybU%3DYw6A1fvtSLZYg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.