From: Arend van Spriel <arend@broadcom.com>
To: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Cc: Brett Rudley <brudley@broadcom.com>,
<linux-wireless@vger.kernel.org>,
<brcm80211-dev-list@broadcom.com>, <netdev@vger.kernel.org>,
<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2] net/wireless/brcm80211/brcmfmac: Make return type and name reflect actual semantics
Date: Sun, 22 Jun 2014 11:37:21 +0200 [thread overview]
Message-ID: <53A6A3D1.60505@broadcom.com> (raw)
In-Reply-To: <53A6A189.1020401@broadcom.com>
On 06/22/14 11:27, Arend van Spriel wrote:
> On 06/22/14 00:55, Rasmus Villemoes wrote:
>> Applying ++ to a bool is equivalent to setting it true, regardless of
>> its initial value (bools are not uint1_t). Hence the function
>> wl_get_vif_state_all can only ever return true/false. The only in-tree
>> caller uses its return value as a boolean. So update its return type,
>> and since the list traversal and bit testing have no side effects,
>> just return true immediately. Its return value tells if any vif is up,
>
- Now I may be really nit-picking, but the return value if any vif is *in
- the specified state*.
+ Now I may be really nit-picking, but the return value tells if any
+ vif is *in the specified state*.
>
> Regards,
> Arend
>
>> so also rename it to brcmf_get_vif_state_any.
>>
>> Reviewed-by: Arend van Spriel<arend@broadcom.com>
>> Signed-off-by: Rasmus Villemoes<linux@rasmusvillemoes.dk>
>> ---
>>
>> Notes:
>> v2: Rename wl_get_vif_state_all => brcmf_get_vif_state_any as
>> requested by Arend.
>>
>> drivers/net/wireless/brcm80211/brcmfmac/p2p.c | 2 +-
>> drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c | 7 +++----
>> drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.h | 2 +-
>> 3 files changed, 5 insertions(+), 6 deletions(-)
>>
>> diff --git a/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
>> b/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
>> index f3445ac..588fdbd 100644
>> --- a/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
>> +++ b/drivers/net/wireless/brcm80211/brcmfmac/p2p.c
>> @@ -708,7 +708,7 @@ static s32 brcmf_p2p_escan(struct brcmf_p2p_info
>> *p2p, u32 num_chans,
>> active = P2PAPI_SCAN_SOCIAL_DWELL_TIME_MS;
>> else if (num_chans == AF_PEER_SEARCH_CNT)
>> active = P2PAPI_SCAN_AF_SEARCH_DWELL_TIME_MS;
>> - else if (wl_get_vif_state_all(p2p->cfg, BRCMF_VIF_STATUS_CONNECTED))
>> + else if (brcmf_get_vif_state_any(p2p->cfg, BRCMF_VIF_STATUS_CONNECTED))
>> active = -1;
>> else
>> active = P2PAPI_SCAN_DWELL_TIME_MS;
>> diff --git a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c
>> b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c
>> index d8fa276..93b1809 100644
>> --- a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c
>> +++ b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c
>> @@ -5625,16 +5625,15 @@ enum nl80211_iftype
>> brcmf_cfg80211_get_iftype(struct brcmf_if *ifp)
>> return wdev->iftype;
>> }
>>
>> -u32 wl_get_vif_state_all(struct brcmf_cfg80211_info *cfg, unsigned
>> long state)
>> +bool brcmf_get_vif_state_any(struct brcmf_cfg80211_info *cfg,
>> unsigned long state)
>> {
>> struct brcmf_cfg80211_vif *vif;
>> - bool result = 0;
>>
>> list_for_each_entry(vif,&cfg->vif_list, list) {
>> if (test_bit(state,&vif->sme_state))
>> - result++;
>> + return true;
>> }
>> - return result;
>> + return false;
>> }
>>
>> static inline bool vif_event_equals(struct brcmf_cfg80211_vif_event
>> *event,
>> diff --git a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.h
>> b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.h
>> index 283c525..f9fb109 100644
>> --- a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.h
>> +++ b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.h
>> @@ -477,7 +477,7 @@ const struct brcmf_tlv *
>> brcmf_parse_tlvs(const void *buf, int buflen, uint key);
>> u16 channel_to_chanspec(struct brcmu_d11inf *d11inf,
>> struct ieee80211_channel *ch);
>> -u32 wl_get_vif_state_all(struct brcmf_cfg80211_info *cfg, unsigned
>> long state);
>> +bool brcmf_get_vif_state_any(struct brcmf_cfg80211_info *cfg,
>> unsigned long state);
>> void brcmf_cfg80211_arm_vif_event(struct brcmf_cfg80211_info *cfg,
>> struct brcmf_cfg80211_vif *vif);
>> bool brcmf_cfg80211_vif_event_armed(struct brcmf_cfg80211_info *cfg);
>
next prev parent reply other threads:[~2014-06-22 9:37 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-20 21:32 [PATCH] net/wireless/brcm80211/brcmfmac: Make return type reflect actual semantics Rasmus Villemoes
2014-06-21 10:20 ` Arend van Spriel
2014-06-21 22:55 ` [PATCH v2] net/wireless/brcm80211/brcmfmac: Make return type and name " Rasmus Villemoes
2014-06-22 9:27 ` Arend van Spriel
2014-06-22 9:37 ` Arend van Spriel [this message]
2014-06-22 18:50 ` [PATCH v3] " Rasmus Villemoes
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=53A6A3D1.60505@broadcom.com \
--to=arend@broadcom.com \
--cc=brcm80211-dev-list@broadcom.com \
--cc=brudley@broadcom.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=linux@rasmusvillemoes.dk \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).