From patchwork Fri Mar 7 02:17:27 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gang ZHAO X-Patchwork-Id: 3787241 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 8B204BF540 for ; Fri, 7 Mar 2014 02:20:37 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id AB548201FB for ; Fri, 7 Mar 2014 02:20:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C2C05201EF for ; Fri, 7 Mar 2014 02:20:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751716AbaCGCUd (ORCPT ); Thu, 6 Mar 2014 21:20:33 -0500 Received: from mail-pa0-f47.google.com ([209.85.220.47]:63983 "EHLO mail-pa0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751577AbaCGCUc (ORCPT ); Thu, 6 Mar 2014 21:20:32 -0500 Received: by mail-pa0-f47.google.com with SMTP id lj1so3488628pab.34 for ; Thu, 06 Mar 2014 18:20:32 -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; bh=zTN679R+DrMCCCDcAC4YX4yFIq/+heVBprXGHn+B8GE=; b=JlDbWgl2jBuXlOU4uP9WWwUhrp6AS5rtIBjNcV06ZlwITUCvwXBIHCeEwdnoQ87AYi rPPbbcPS7lGxckjdVcgXTmXZgQ0/BzUNJcdK5RjHBtcMFVZMct0djJOhguJpuQIbEN8j O+F7qhs+tXNo3wZhbOMatyjn+fluDmm2Wi5SXNgX7zzFzMiMNGXlM5IumYiBSmjSy68g 1UbkVLDw2rnQHBFTTKJn+ten4mEzuM1zlxOww8OEX+tClUlStxGtFQYwAVxS3DRkEfnW /cof9TTxqtUlPUk1ZL3R6AbVYmQzmP1u0HPlp4nYoYZMNN24HoOEXkg1pwEfhEdP6FMq hx1w== X-Received: by 10.68.254.103 with SMTP id ah7mr18278647pbd.159.1394158832287; Thu, 06 Mar 2014 18:20:32 -0800 (PST) Received: from will.lan ([175.153.40.106]) by mx.google.com with ESMTPSA id op3sm25195883pbc.40.2014.03.06.18.20.28 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 06 Mar 2014 18:20:31 -0800 (PST) From: "Zhao, Gang" To: Cc: Johannes Berg Subject: [PATCH 1/4] mac80211: refactor recalculate channel context functions (1) Date: Fri, 7 Mar 2014 10:17:27 +0800 Message-Id: <8966cabb0cf4c83da8fd37e4a5ec1df8727e9dbe.1394158459.git.gamerh2o@gmail.com> X-Mailer: git-send-email 1.8.5.3 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 Function ieee80211_change_chanctx() updates struct ieee80211_chanctx_conf's def and min_def members, in a somewhat mixed way. Since there are other members can be updated, this function's name is a bit inaccurate. Rename ieee80211_change_chanctx() to ieee80211_recalc_chanctx_def() and only update def member in this function. Add a wrapper function _ieee80211_recalc_chanctx_chantype() to do ieee80211_change_chanctx()'s work. Signed-off-by: Zhao, Gang --- net/mac80211/chan.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/net/mac80211/chan.c b/net/mac80211/chan.c index 42c6592..49fa37e 100644 --- a/net/mac80211/chan.c +++ b/net/mac80211/chan.c @@ -143,9 +143,10 @@ void ieee80211_recalc_chanctx_min_def(struct ieee80211_local *local, drv_change_chanctx(local, ctx, IEEE80211_CHANCTX_CHANGE_MIN_WIDTH); } -static void ieee80211_change_chanctx(struct ieee80211_local *local, - struct ieee80211_chanctx *ctx, - const struct cfg80211_chan_def *chandef) +static void +ieee80211_recalc_chanctx_def(struct ieee80211_local *local, + struct ieee80211_chanctx *ctx, + const struct cfg80211_chan_def *chandef) { if (cfg80211_chandef_identical(&ctx->conf.def, chandef)) return; @@ -154,7 +155,6 @@ static void ieee80211_change_chanctx(struct ieee80211_local *local, ctx->conf.def = *chandef; drv_change_chanctx(local, ctx, IEEE80211_CHANCTX_CHANGE_WIDTH); - ieee80211_recalc_chanctx_min_def(local, ctx); if (!local->use_chanctx) { local->_oper_chandef = *chandef; @@ -162,6 +162,15 @@ static void ieee80211_change_chanctx(struct ieee80211_local *local, } } +static void +_ieee80211_recalc_chanctx_chantype(struct ieee80211_local *local, + struct ieee80211_chanctx *ctx, + const struct cfg80211_chan_def *chandef) +{ + ieee80211_recalc_chanctx_def(local, ctx, chandef); + ieee80211_recalc_chanctx_min_def(local, ctx); +} + static struct ieee80211_chanctx * ieee80211_find_chanctx(struct ieee80211_local *local, const struct cfg80211_chan_def *chandef, @@ -184,7 +193,7 @@ ieee80211_find_chanctx(struct ieee80211_local *local, if (!compat) continue; - ieee80211_change_chanctx(local, ctx, compat); + _ieee80211_recalc_chanctx_chantype(local, ctx, compat); return ctx; } @@ -350,7 +359,7 @@ static void ieee80211_recalc_chanctx_chantype(struct ieee80211_local *local, if (WARN_ON_ONCE(!compat)) return; - ieee80211_change_chanctx(local, ctx, compat); + _ieee80211_recalc_chanctx_chantype(local, ctx, compat); } static void ieee80211_recalc_radar_chanctx(struct ieee80211_local *local,