From patchwork Fri Mar 21 13:47: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: 3874431 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 3770A9F3FF for ; Fri, 21 Mar 2014 13:54:27 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 595342012D for ; Fri, 21 Mar 2014 13:54:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 81E472012E for ; Fri, 21 Mar 2014 13:54:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965333AbaCUNx4 (ORCPT ); Fri, 21 Mar 2014 09:53:56 -0400 Received: from mail-ee0-f43.google.com ([74.125.83.43]:47686 "EHLO mail-ee0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1760946AbaCUNxq (ORCPT ); Fri, 21 Mar 2014 09:53:46 -0400 Received: by mail-ee0-f43.google.com with SMTP id e53so1823869eek.16 for ; Fri, 21 Mar 2014 06:53:45 -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=5F2tpa7QaATJjtdy6Y8PZ1g2FUY+F2LMOYjut9aGeVE=; b=o+2o4u6fYh30JvJFxPmyDDMq4opoEFUwQJgnWCoGnTRbhSU69oYqs8dwt8RZx0r/jy fAOJXi/rrTARAGK2dWfpvpBLnQ8dl/sVYrVJAagaAAEt6r2xm0joqJJ4gEAzaUvp/25I jcvySph+Brrrtv9w3nNNTXwJPz78M5Z6ma5ac= 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=5F2tpa7QaATJjtdy6Y8PZ1g2FUY+F2LMOYjut9aGeVE=; b=DzKZ9H1zVnhxb1VPZ4ZfxPiWOMArl52OBrHZjNoIRO/FDN/70/czAJkwLm/mRJG9cL 1GtgsapfumzNvp5yecYlDO++S9d910eKepQMj5c3q29GQUFbEnLqsexa/+4NVCU4gyxL 4VSYU0gtD+OTCtnsGy1vzfT8Y3fmQ8hKVztfuMvA1Rc2Yv0yESuB4mTELfr7c08rKUFS HIvNrTkt+2E0vR7FWLPKH6afhc9OBt9jY0kuTjyJP3rsWpFrmKsLCrj3RYymsWi6wA4Z GC7lAcrhJI+t9WbJbLDAJQo9Orp11CtfFO0kdC0JBS6Rhsp7jXm0Vt43DrJl87WTvAnI 634Q== X-Gm-Message-State: ALoCoQl9+TecxuBtGP8JWGcprcl6ZO6F6cSeK01KswxNRW/LXHpCM0xGsGvK2JcMQGnrtTMjfHEfXuJIU/MLjnlYqTSXB9E7RGU+2Zr1me8gm55LLCgM0BQ= X-Received: by 10.14.209.193 with SMTP id s41mr1896505eeo.108.1395410025181; Fri, 21 Mar 2014 06:53:45 -0700 (PDT) Received: from localhost.localdomain ([91.198.246.8]) by mx.google.com with ESMTPSA id o7sm11719458eew.25.2014.03.21.06.53.43 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 21 Mar 2014 06:53:44 -0700 (PDT) From: Michal Kazior To: linux-wireless@vger.kernel.org Cc: johannes@sipsolutions.net, Michal Kazior Subject: [PATCH v2 10/13] mac80211: split ieee80211_free_chanctx() Date: Fri, 21 Mar 2014 14:47:28 +0100 Message-Id: <1395409651-26120-11-git-send-email-michal.kazior@tieto.com> X-Mailer: git-send-email 1.8.5.3 In-Reply-To: <1395409651-26120-1-git-send-email-michal.kazior@tieto.com> References: <1395150804-24090-1-git-send-email-michal.kazior@tieto.com> <1395409651-26120-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=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, 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 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 561d7c1..74459a7 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,