From patchwork Fri Mar 7 02:17:28 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gang ZHAO X-Patchwork-Id: 3787251 Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id E0CC8BF540 for ; Fri, 7 Mar 2014 02:20:39 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 11282201FB for ; Fri, 7 Mar 2014 02:20:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2D661201EF for ; Fri, 7 Mar 2014 02:20:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751923AbaCGCUf (ORCPT ); Thu, 6 Mar 2014 21:20:35 -0500 Received: from mail-pd0-f169.google.com ([209.85.192.169]:48986 "EHLO mail-pd0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751767AbaCGCUf (ORCPT ); Thu, 6 Mar 2014 21:20:35 -0500 Received: by mail-pd0-f169.google.com with SMTP id fp1so3378870pdb.14 for ; Thu, 06 Mar 2014 18:20:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=vFIa+O/AoIjREPX4qa6M8tpOxf0J97nZ1cW48+QzFAM=; b=VHETFTwZaIE6RgemOhMBVFfEYElNrh0LJ+eqhYhP1S1+o553bSKLjcU4rGoeBAhsjY L+FN/hK6BDhmIfRbC1UNXSJ2AbmwRA9RYiq0GwkyJG8MIBeqkbANi/fscFFanVcnIC/B ZQjZ3zItpQsCOzCuUh/2et5FoVdjIt7vRyt1ZC59dpKcyhtcMR4gPRI5NHUOPx65ehK1 O3rLWG+9gHI7HqqIpHIUecnK6s/lDlp6WoCSIONlmBTSvC9CgCy+xlKlmZd8eaEC3Mve cTy/WXgf6XY7f9CV5k9DO5aCVTQbVoGs1vrFbJ431/UmTifGtnY8G1bpcp1Zs5W26VBC I1/Q== X-Received: by 10.68.184.66 with SMTP id es2mr18639712pbc.19.1394158834635; Thu, 06 Mar 2014 18:20:34 -0800 (PST) Received: from will.lan ([175.153.40.106]) by mx.google.com with ESMTPSA id op3sm25195883pbc.40.2014.03.06.18.20.32 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 06 Mar 2014 18:20:34 -0800 (PST) From: "Zhao, Gang" To: Cc: Johannes Berg Subject: [PATCH 2/4] mac80211: refactor recalculate channel context functions (2) Date: Fri, 7 Mar 2014 10:17:28 +0800 Message-Id: X-Mailer: git-send-email 1.8.5.3 In-Reply-To: <8966cabb0cf4c83da8fd37e4a5ec1df8727e9dbe.1394158459.git.gamerh2o@gmail.com> References: <8966cabb0cf4c83da8fd37e4a5ec1df8727e9dbe.1394158459.git.gamerh2o@gmail.com> In-Reply-To: <8966cabb0cf4c83da8fd37e4a5ec1df8727e9dbe.1394158459.git.gamerh2o@gmail.com> References: <8966cabb0cf4c83da8fd37e4a5ec1df8727e9dbe.1394158459.git.gamerh2o@gmail.com> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Change function ieee80211_recalc_chanctx_chantype's position in the file, if the change is included in next patch, the next patch's diff will be a mess... Signed-off-by: Zhao, Gang --- net/mac80211/chan.c | 66 ++++++++++++++++++++++++++--------------------------- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/net/mac80211/chan.c b/net/mac80211/chan.c index 49fa37e..543beba 100644 --- a/net/mac80211/chan.c +++ b/net/mac80211/chan.c @@ -171,6 +171,39 @@ _ieee80211_recalc_chanctx_chantype(struct ieee80211_local *local, ieee80211_recalc_chanctx_min_def(local, ctx); } +static void ieee80211_recalc_chanctx_chantype(struct ieee80211_local *local, + struct ieee80211_chanctx *ctx) +{ + struct ieee80211_chanctx_conf *conf = &ctx->conf; + struct ieee80211_sub_if_data *sdata; + const struct cfg80211_chan_def *compat = NULL; + + lockdep_assert_held(&local->chanctx_mtx); + + rcu_read_lock(); + list_for_each_entry_rcu(sdata, &local->interfaces, list) { + + if (!ieee80211_sdata_running(sdata)) + continue; + if (rcu_access_pointer(sdata->vif.chanctx_conf) != conf) + continue; + + if (!compat) + compat = &sdata->vif.bss_conf.chandef; + + compat = cfg80211_chandef_compatible( + &sdata->vif.bss_conf.chandef, compat); + if (!compat) + break; + } + rcu_read_unlock(); + + if (WARN_ON_ONCE(!compat)) + return; + + _ieee80211_recalc_chanctx_chantype(local, ctx, compat); +} + static struct ieee80211_chanctx * ieee80211_find_chanctx(struct ieee80211_local *local, const struct cfg80211_chan_def *chandef, @@ -329,39 +362,6 @@ static int ieee80211_assign_vif_chanctx(struct ieee80211_sub_if_data *sdata, return 0; } -static void ieee80211_recalc_chanctx_chantype(struct ieee80211_local *local, - struct ieee80211_chanctx *ctx) -{ - struct ieee80211_chanctx_conf *conf = &ctx->conf; - struct ieee80211_sub_if_data *sdata; - const struct cfg80211_chan_def *compat = NULL; - - lockdep_assert_held(&local->chanctx_mtx); - - rcu_read_lock(); - list_for_each_entry_rcu(sdata, &local->interfaces, list) { - - if (!ieee80211_sdata_running(sdata)) - continue; - if (rcu_access_pointer(sdata->vif.chanctx_conf) != conf) - continue; - - if (!compat) - compat = &sdata->vif.bss_conf.chandef; - - compat = cfg80211_chandef_compatible( - &sdata->vif.bss_conf.chandef, compat); - if (!compat) - break; - } - rcu_read_unlock(); - - if (WARN_ON_ONCE(!compat)) - return; - - _ieee80211_recalc_chanctx_chantype(local, ctx, compat); -} - static void ieee80211_recalc_radar_chanctx(struct ieee80211_local *local, struct ieee80211_chanctx *chanctx) {