From patchwork Fri Mar 7 02:17:30 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gang ZHAO X-Patchwork-Id: 3787271 Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 818C19F35F for ; Fri, 7 Mar 2014 02:20:44 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8D880201FB for ; Fri, 7 Mar 2014 02:20:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9A566201EF for ; Fri, 7 Mar 2014 02:20:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752229AbaCGCUk (ORCPT ); Thu, 6 Mar 2014 21:20:40 -0500 Received: from mail-pd0-f176.google.com ([209.85.192.176]:46026 "EHLO mail-pd0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751767AbaCGCUj (ORCPT ); Thu, 6 Mar 2014 21:20:39 -0500 Received: by mail-pd0-f176.google.com with SMTP id r10so3384189pdi.35 for ; Thu, 06 Mar 2014 18:20:39 -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=2cCN0vguT3kCjUuENM4dML3pUGjR9JTDUprbu19yKaU=; b=f73uxjN7q2ZKRbkO/c/2FBR7bR9TGvRoRjHGkCx+aMqJqUWcn8Ptn/3STPekEvi4Nr ZKhipFd4xPHRWcBXkHCqlhIF0E/G+1TgF4No80O8MQGRXcsZmsi26TX5S02wqLZ1Nk0d ynf+CTwcXKAysDpaQkIdoytJ9ohfcdxa7xUL/VnDAu1lDkGyEBBOpYtCBiIZFmsl+zvP ljrPdlYKvl23PTXF2z4X+Abwr+Jhyr7UyzPyBbcpeqdeTuzJn1W7uZA7wJndwtmP9Sqw ixZiE5xzZe4dihRzy20w7AU/F7tAIiI9OSKOqgV2WTugbl/6jJiKdfJl/OCdGobGpV9u /r1w== X-Received: by 10.68.237.228 with SMTP id vf4mr18589987pbc.131.1394158839454; Thu, 06 Mar 2014 18:20:39 -0800 (PST) Received: from will.lan ([175.153.40.106]) by mx.google.com with ESMTPSA id op3sm25195883pbc.40.2014.03.06.18.20.37 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 06 Mar 2014 18:20:39 -0800 (PST) From: "Zhao, Gang" To: Cc: Johannes Berg Subject: [PATCH 4/4] mac80211: refactor recalculate channel context functions (4) Date: Fri, 7 Mar 2014 10:17:30 +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 name ieee80211_recalc_{radar, smps}_chanctx to ieee80211_recalc_chanctx_{radar, smps} to be consistent with other ieee80211_recalc_chanctx_* functions. Add a wrapper function ieee80211_recalc_chanctx() to reduce code duplication. Signed-off-by: Zhao, Gang --- net/mac80211/chan.c | 30 ++++++++++++++++-------------- net/mac80211/ieee80211_i.h | 2 +- net/mac80211/util.c | 2 +- 3 files changed, 18 insertions(+), 16 deletions(-) diff --git a/net/mac80211/chan.c b/net/mac80211/chan.c index ebcc0e7..207b224 100644 --- a/net/mac80211/chan.c +++ b/net/mac80211/chan.c @@ -222,7 +222,7 @@ static bool ieee80211_is_radar_required(struct ieee80211_local *local) return false; } -static void ieee80211_recalc_radar_chanctx(struct ieee80211_local *local, +static void ieee80211_recalc_chanctx_radar(struct ieee80211_local *local, struct ieee80211_chanctx *chanctx) { bool radar_enabled; @@ -247,7 +247,7 @@ static void ieee80211_recalc_radar_chanctx(struct ieee80211_local *local, drv_change_chanctx(local, chanctx, IEEE80211_CHANCTX_CHANGE_RADAR); } -void ieee80211_recalc_smps_chanctx(struct ieee80211_local *local, +void ieee80211_recalc_chanctx_smps(struct ieee80211_local *local, struct ieee80211_chanctx *chanctx) { struct ieee80211_sub_if_data *sdata; @@ -330,6 +330,15 @@ void ieee80211_recalc_smps_chanctx(struct ieee80211_local *local, drv_change_chanctx(local, chanctx, IEEE80211_CHANCTX_CHANGE_RX_CHAINS); } +static void ieee80211_recalc_chanctx(struct ieee80211_local *local, + struct ieee80211_chanctx *ctx) +{ + ieee80211_recalc_chanctx_chantype(local, ctx); + ieee80211_recalc_chanctx_smps(local, ctx); + ieee80211_recalc_chanctx_radar(local, ctx); + ieee80211_recalc_chanctx_min_def(local, ctx); +} + static struct ieee80211_chanctx * ieee80211_find_chanctx(struct ieee80211_local *local, const struct cfg80211_chan_def *chandef, @@ -488,12 +497,8 @@ static void ieee80211_unassign_vif_chanctx(struct ieee80211_sub_if_data *sdata, drv_unassign_vif_chanctx(local, sdata, ctx); - if (ctx->refcount > 0) { - ieee80211_recalc_chanctx_chantype(sdata->local, ctx); - ieee80211_recalc_smps_chanctx(local, ctx); - ieee80211_recalc_radar_chanctx(local, ctx); - ieee80211_recalc_chanctx_min_def(local, ctx); - } + if (ctx->refcount > 0) + ieee80211_recalc_chanctx(local, ctx); } static void __ieee80211_vif_release_channel(struct ieee80211_sub_if_data *sdata) @@ -549,8 +554,8 @@ int ieee80211_vif_use_channel(struct ieee80211_sub_if_data *sdata, goto out; } - ieee80211_recalc_smps_chanctx(local, ctx); - ieee80211_recalc_radar_chanctx(local, ctx); + ieee80211_recalc_chanctx_smps(local, ctx); + ieee80211_recalc_chanctx_radar(local, ctx); out: mutex_unlock(&local->chanctx_mtx); return ret; @@ -601,10 +606,7 @@ int ieee80211_vif_change_channel(struct ieee80211_sub_if_data *sdata, chanctx_changed |= IEEE80211_CHANCTX_CHANGE_CHANNEL; drv_change_chanctx(local, ctx, chanctx_changed); - ieee80211_recalc_chanctx_chantype(local, ctx); - ieee80211_recalc_smps_chanctx(local, ctx); - ieee80211_recalc_radar_chanctx(local, ctx); - ieee80211_recalc_chanctx_min_def(local, ctx); + ieee80211_recalc_chanctx(local, ctx); ret = 0; out: diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h index 8603dfb..ca1c636 100644 --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h @@ -1788,7 +1788,7 @@ void ieee80211_vif_vlan_copy_chanctx(struct ieee80211_sub_if_data *sdata); void ieee80211_vif_copy_chanctx_to_vlans(struct ieee80211_sub_if_data *sdata, bool clear); -void ieee80211_recalc_smps_chanctx(struct ieee80211_local *local, +void ieee80211_recalc_chanctx_smps(struct ieee80211_local *local, struct ieee80211_chanctx *chanctx); void ieee80211_recalc_chanctx_min_def(struct ieee80211_local *local, struct ieee80211_chanctx *ctx); diff --git a/net/mac80211/util.c b/net/mac80211/util.c index d842af5..013b5fd 100644 --- a/net/mac80211/util.c +++ b/net/mac80211/util.c @@ -1859,7 +1859,7 @@ void ieee80211_recalc_smps(struct ieee80211_sub_if_data *sdata) goto unlock; chanctx = container_of(chanctx_conf, struct ieee80211_chanctx, conf); - ieee80211_recalc_smps_chanctx(local, chanctx); + ieee80211_recalc_chanctx_smps(local, chanctx); unlock: mutex_unlock(&local->chanctx_mtx); }