Commit e843bb19 authored by Rasmus Villemoes's avatar Rasmus Villemoes Committed by John W. Linville

net/wireless/brcm80211/brcmfmac: Make return type and name reflect actual semantics

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 in
the specified state, so also rename it to brcmf_get_vif_state_any.

Reviewed-by: Arend van Spriel<arend@broadcom.com>
Signed-off-by: default avatarRasmus Villemoes <linux@rasmusvillemoes.dk>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 363c1b4f
...@@ -708,7 +708,7 @@ static s32 brcmf_p2p_escan(struct brcmf_p2p_info *p2p, u32 num_chans, ...@@ -708,7 +708,7 @@ static s32 brcmf_p2p_escan(struct brcmf_p2p_info *p2p, u32 num_chans,
active = P2PAPI_SCAN_SOCIAL_DWELL_TIME_MS; active = P2PAPI_SCAN_SOCIAL_DWELL_TIME_MS;
else if (num_chans == AF_PEER_SEARCH_CNT) else if (num_chans == AF_PEER_SEARCH_CNT)
active = P2PAPI_SCAN_AF_SEARCH_DWELL_TIME_MS; 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; active = -1;
else else
active = P2PAPI_SCAN_DWELL_TIME_MS; active = P2PAPI_SCAN_DWELL_TIME_MS;
......
...@@ -5619,16 +5619,15 @@ enum nl80211_iftype brcmf_cfg80211_get_iftype(struct brcmf_if *ifp) ...@@ -5619,16 +5619,15 @@ enum nl80211_iftype brcmf_cfg80211_get_iftype(struct brcmf_if *ifp)
return wdev->iftype; 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; struct brcmf_cfg80211_vif *vif;
bool result = 0;
list_for_each_entry(vif, &cfg->vif_list, list) { list_for_each_entry(vif, &cfg->vif_list, list) {
if (test_bit(state, &vif->sme_state)) 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, static inline bool vif_event_equals(struct brcmf_cfg80211_vif_event *event,
......
...@@ -477,7 +477,7 @@ const struct brcmf_tlv * ...@@ -477,7 +477,7 @@ const struct brcmf_tlv *
brcmf_parse_tlvs(const void *buf, int buflen, uint key); brcmf_parse_tlvs(const void *buf, int buflen, uint key);
u16 channel_to_chanspec(struct brcmu_d11inf *d11inf, u16 channel_to_chanspec(struct brcmu_d11inf *d11inf,
struct ieee80211_channel *ch); 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, void brcmf_cfg80211_arm_vif_event(struct brcmf_cfg80211_info *cfg,
struct brcmf_cfg80211_vif *vif); struct brcmf_cfg80211_vif *vif);
bool brcmf_cfg80211_vif_event_armed(struct brcmf_cfg80211_info *cfg); bool brcmf_cfg80211_vif_event_armed(struct brcmf_cfg80211_info *cfg);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment