From patchwork Wed Jan 4 10:53:37 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arend van Spriel X-Patchwork-Id: 9496451 X-Patchwork-Delegate: johannes@sipsolutions.net Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id AEEE3606A9 for ; Wed, 4 Jan 2017 10:54:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A612527D85 for ; Wed, 4 Jan 2017 10:54:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 99D1127E63; Wed, 4 Jan 2017 10:54:13 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7F0EB27D85 for ; Wed, 4 Jan 2017 10:54:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935202AbdADKyA (ORCPT ); Wed, 4 Jan 2017 05:54:00 -0500 Received: from lpdvsmtp01.broadcom.com ([192.19.211.62]:43116 "EHLO relay.smtp.broadcom.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935177AbdADKx6 (ORCPT ); Wed, 4 Jan 2017 05:53:58 -0500 Received: from mail-irv-17.broadcom.com (smtphost.broadcom.com [10.15.198.34]) by relay.smtp.broadcom.com (Postfix) with ESMTP id D98DF2800B3; Wed, 4 Jan 2017 02:53:54 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.10.3 relay.smtp.broadcom.com D98DF2800B3 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=broadcom.com; s=dkimrelay; t=1483527235; bh=DD6i/cMkIwaV/GDod1MBEtM/dHyCQdt1dLTj97bnvGU=; h=From:To:Cc:Subject:Date:From; b=EvXRo7VMZIqh3vVv9/sJP/xeFZoVRRZ4e1LOhZKnTV/e2tPDAQ8p4DepABKpQfQRD 4PPbAwop+jbolKpUmoqj/i3q1MSnK8UzMi7whAYiW/81CD2k0ZL1Z+TijM59+mhBMQ cXlGDu95z1ndC2gbRLpGj+3SNRayMPXxQCkpF31c= Received: from jenkins-cam-14.cam.broadcom.com (jenkins-cam-14.cam.broadcom.com [10.177.128.77]) by mail-irv-17.broadcom.com (Postfix) with ESMTP id 082B581F52; Wed, 4 Jan 2017 02:53:54 -0800 (PST) Received: by jenkins-cam-14.cam.broadcom.com (Postfix, from userid 25152) id 4E787B8506C; Wed, 4 Jan 2017 10:53:53 +0000 (GMT) From: Arend van Spriel To: Johannes Berg Cc: linux-wireless , Arend van Spriel Subject: [PATCH] cfg80211: only pass sband to set_mandatory_flags_band() Date: Wed, 4 Jan 2017 10:53:37 +0000 Message-Id: <1483527217-11854-1-git-send-email-arend.vanspriel@broadcom.com> X-Mailer: git-send-email 1.9.1 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The supported band structure contains the band is applies to so no need to pass it separately. Also added a default case to the switch for completeness. The current code base does not call this function with NUM_NL80211_BANDS but kept that case statement although default case would cover that. Signed-off-by: Arend van Spriel --- Stumbled upon this function and wanted to start the new year lightly. It applies to master branch of mac80211-next repo. Best wishes, Arend --- net/wireless/util.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/net/wireless/util.c b/net/wireless/util.c index 2cf7df8..c91bc25 100644 --- a/net/wireless/util.c +++ b/net/wireless/util.c @@ -136,12 +136,11 @@ struct ieee80211_channel *ieee80211_get_channel(struct wiphy *wiphy, int freq) } EXPORT_SYMBOL(ieee80211_get_channel); -static void set_mandatory_flags_band(struct ieee80211_supported_band *sband, - enum nl80211_band band) +static void set_mandatory_flags_band(struct ieee80211_supported_band *sband) { int i, want; - switch (band) { + switch (sband->band) { case NL80211_BAND_5GHZ: want = 3; for (i = 0; i < sband->n_bitrates; i++) { @@ -191,6 +190,7 @@ static void set_mandatory_flags_band(struct ieee80211_supported_band *sband, WARN_ON((sband->ht_cap.mcs.rx_mask[0] & 0x1e) != 0x1e); break; case NUM_NL80211_BANDS: + default: WARN_ON(1); break; } @@ -202,7 +202,7 @@ void ieee80211_set_bitrate_flags(struct wiphy *wiphy) for (band = 0; band < NUM_NL80211_BANDS; band++) if (wiphy->bands[band]) - set_mandatory_flags_band(wiphy->bands[band], band); + set_mandatory_flags_band(wiphy->bands[band]); } bool cfg80211_supported_cipher_suite(struct wiphy *wiphy, u32 cipher)