Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3329318imu; Sun, 11 Nov 2018 12:30:13 -0800 (PST) X-Google-Smtp-Source: AJdET5fZ8EKDrYIE4Ng1Tq6tThHeyH2pymAHRW7bPKJGDI3wFoaQ/5/dOvueNtJIwvltfyXef3Ik X-Received: by 2002:a63:83c1:: with SMTP id h184mr15052867pge.437.1541968212957; Sun, 11 Nov 2018 12:30:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541968212; cv=none; d=google.com; s=arc-20160816; b=ECNfopVkF8rVsDP5Qwo0am9iT7kjLiEd79XjBkUDB7lc1AHqUQ3AmEVARI/nXRlB+V AlL0cJKD4rUPoVQMeG1AAfynNkbwj8aOJJuDn8io41mCJN3uE2Qxa/9qMdpW6JPMfY/f p9SH9rWdhH2/mSxlN1ehi2yNm1/Olf2UZBOroZ+E55bEO7afilLwULB8p6NESk5sZHDl w9fevYQYlpx2b/MzJnIgCQ/6Gq4pjqWh04139rNLG8MWPBgOk3b7rt30vkyf39FaVwuD 92KiajKEl2e7feAyS7tTmW+7Jb+CuqXom99Hq4lc3Ex0KrBl3gXgstsMudwYd4nm6d9G O/hA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:subject:message-id:date:cc:to :from:mime-version:content-transfer-encoding:content-disposition; bh=+rXtyTnVqE8hTEyDau3Y3kV27+NWOE9TOX/qugNo9sU=; b=PRgPr/c8BmDxGp7fxp39NQ206mXQNZBK9Mi7iHNpRPhVbP14bFg1bOw3YDdKN0SnoC wLplxBkd0Ru8EtSpHF9nOHUN+Eusk1FhYwi+QTb2ekgFzGF+MdWpMmbqQdLOSb2JAOci +yxDwyMpPllmvB9egU3U48QQDg22rjW1zVUeEapvPPHcB5qk6js2izBMDVECztDo9nqY malY+EO076h5esrCYYPnea6YqbIwGOe9lAHGki3kWMPM/P27RLEswBV7TeBr9TQNmJ73 Rl3Vs3nea17zbqWkgFXRHpBxkhOWJIdyT3K+SjIZOR2yY/YchnTPDaR/HuIdbJUApNbY n3wQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 12-v6si4426399plb.324.2018.11.11.12.29.57; Sun, 11 Nov 2018 12:30:12 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731510AbeKLGTE (ORCPT + 99 others); Mon, 12 Nov 2018 01:19:04 -0500 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:50522 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730449AbeKLFsW (ORCPT ); Mon, 12 Nov 2018 00:48:22 -0500 Received: from [192.168.4.242] (helo=deadeye) by shadbolt.decadent.org.uk with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1gLvsh-0000lM-5p; Sun, 11 Nov 2018 19:58:51 +0000 Received: from ben by deadeye with local (Exim 4.91) (envelope-from ) id 1gLvsa-0001s4-Ai; Sun, 11 Nov 2018 19:58:44 +0000 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 From: Ben Hutchings To: linux-kernel@vger.kernel.org, stable@vger.kernel.org CC: akpm@linux-foundation.org, "Rasmus Villemoes" , "John W. Linville" , "Arend van Spriel" Date: Sun, 11 Nov 2018 19:49:05 +0000 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) Subject: [PATCH 3.16 343/366] net/wireless/brcm80211/brcmfmac: Make return type and name reflect actual semantics In-Reply-To: X-SA-Exim-Connect-IP: 192.168.4.242 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.16.61-rc1 review patch. If anyone has any objections, please let me know. ------------------ From: Rasmus Villemoes commit e843bb199ba58ce5d1364d4c82fcf6975f08eec2 upstream. 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 Signed-off-by: Rasmus Villemoes Signed-off-by: John W. Linville Signed-off-by: Ben Hutchings --- 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(-) --- a/drivers/net/wireless/brcm80211/brcmfmac/p2p.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/p2p.c @@ -706,7 +706,7 @@ static s32 brcmf_p2p_escan(struct brcmf_ 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; --- a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c @@ -5647,16 +5647,15 @@ enum nl80211_iftype brcmf_cfg80211_get_i 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, --- 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);