From patchwork Mon Mar 31 10:39:28 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Kazior X-Patchwork-Id: 3913671 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 7CF7D9F357 for ; Mon, 31 Mar 2014 11:43:51 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9A1ED203AC for ; Mon, 31 Mar 2014 11:43:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C1A6820386 for ; Mon, 31 Mar 2014 11:43:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752953AbaCaLno (ORCPT ); Mon, 31 Mar 2014 07:43:44 -0400 Received: from mail-we0-f174.google.com ([74.125.82.174]:41818 "EHLO mail-we0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753043AbaCaLn0 (ORCPT ); Mon, 31 Mar 2014 07:43:26 -0400 Received: by mail-we0-f174.google.com with SMTP id t60so4556422wes.5 for ; Mon, 31 Mar 2014 04:43:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tieto.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=ZZjowzcXZSS3DJ85raYfs0x7Qq5O5205lRvY967k55U=; b=0ctH87rAZk6Suw1QRaQmC/qnrUYHgiovNSgzzBE3j5PR7/nvvVL3nJlIfbHo+JKe/D rwSyq0TftQryshrnwqKErLzSj1bIGC2rKv8Pgps9RbpqLqfbQqp9lvx/WQLtZXYlNZjf ErvvWVJNlhZ6RewBHHmr4odYwtPw6MpA+jtfw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=ZZjowzcXZSS3DJ85raYfs0x7Qq5O5205lRvY967k55U=; b=Kwm2RPzLU05KOg3w6bZQGq5RR8xDfOQt0P/UEGQooV4lnxlj22kilLdBQgPMBYKKMC Dj4PMKMTqv1f8OUl5Rav5i05IjJly8cKMlKMyfNiFTdA+6g5ieL/4nOfz630EY5xQd/7 UL9H0uvMdHjhxMKFxldY3+VtVvGgbOjD0pmDU3mAS1inDfXjyjhF03qSW9ratTY+TJVm +mMvFZibngwUSsfWdKepQTiEhxLdj89SoqqfkRZoccvv/VF1xQz7a4ep/XxPeIj/S8Bq XB1a0pAgT7+qQ1ZC4lPozGtI1svZf2e/CGZ1SskAIHxa55z6a/lvi2U2LqAM+Xi5n36a F4Yg== X-Gm-Message-State: ALoCoQnzN9E1fpQvDdE+n/3XyrVTtsT2+vzz+FAcDQ7lAASErrVhKFTAKBrJaosIqKYz++btLTM6NYxJycRRKJlU27ib1j67xjEDyQS172cJ9Tn69xcIbVg= X-Received: by 10.194.85.19 with SMTP id d19mr2401516wjz.96.1396266205661; Mon, 31 Mar 2014 04:43:25 -0700 (PDT) Received: from localhost.localdomain ([91.198.246.8]) by mx.google.com with ESMTPSA id q49sm32467516eem.34.2014.03.31.04.43.23 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 31 Mar 2014 04:43:24 -0700 (PDT) From: Michal Kazior To: linux-wireless@vger.kernel.org Cc: johannes@sipsolutions.net, Michal Kazior Subject: [PATCH v3 10/13] mac80211: split ieee80211_free_chanctx() Date: Mon, 31 Mar 2014 12:39:28 +0200 Message-Id: <1396262371-6466-11-git-send-email-michal.kazior@tieto.com> X-Mailer: git-send-email 1.8.5.3 In-Reply-To: <1396262371-6466-1-git-send-email-michal.kazior@tieto.com> References: <1395409651-26120-1-git-send-email-michal.kazior@tieto.com> <1396262371-6466-1-git-send-email-michal.kazior@tieto.com> X-DomainID: tieto.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=-7.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,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 The function did a little too much. Split it up so the code can be easily reused in the future. Signed-off-by: Michal Kazior --- net/mac80211/chan.c | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/net/mac80211/chan.c b/net/mac80211/chan.c index 8e207c0..fc67d4e 100644 --- a/net/mac80211/chan.c +++ b/net/mac80211/chan.c @@ -425,14 +425,11 @@ ieee80211_new_chanctx(struct ieee80211_local *local, return ctx; } -static void ieee80211_free_chanctx(struct ieee80211_local *local, - struct ieee80211_chanctx *ctx) +static void ieee80211_del_chanctx(struct ieee80211_local *local, + struct ieee80211_chanctx *ctx) { - bool check_single_channel = false; lockdep_assert_held(&local->chanctx_mtx); - WARN_ON_ONCE(ctx->refcount != 0); - if (!local->use_chanctx) { struct cfg80211_chan_def *chandef = &local->_oper_chandef; chandef->width = NL80211_CHAN_WIDTH_20_NOHT; @@ -442,8 +439,9 @@ static void ieee80211_free_chanctx(struct ieee80211_local *local, /* NOTE: Disabling radar is only valid here for * single channel context. To be sure, check it ... */ - if (local->hw.conf.radar_enabled) - check_single_channel = true; + WARN_ON(local->hw.conf.radar_enabled && + !list_empty(&local->chanctx_list)); + local->hw.conf.radar_enabled = false; ieee80211_hw_config(local, 0); @@ -451,13 +449,19 @@ static void ieee80211_free_chanctx(struct ieee80211_local *local, drv_remove_chanctx(local, ctx); } - list_del_rcu(&ctx->list); - kfree_rcu(ctx, rcu_head); + ieee80211_recalc_idle(local); +} - /* throw a warning if this wasn't the only channel context. */ - WARN_ON(check_single_channel && !list_empty(&local->chanctx_list)); +static void ieee80211_free_chanctx(struct ieee80211_local *local, + struct ieee80211_chanctx *ctx) +{ + lockdep_assert_held(&local->chanctx_mtx); - ieee80211_recalc_idle(local); + WARN_ON_ONCE(ctx->refcount != 0); + + list_del_rcu(&ctx->list); + ieee80211_del_chanctx(local, ctx); + kfree_rcu(ctx, rcu_head); } static void ieee80211_recalc_chanctx_chantype(struct ieee80211_local *local,