From patchwork Sat Apr 26 01:43:40 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gang ZHAO X-Patchwork-Id: 4067291 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 A5CD0BFF02 for ; Sat, 26 Apr 2014 01:44:00 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C95F520381 for ; Sat, 26 Apr 2014 01:43:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E508D2037F for ; Sat, 26 Apr 2014 01:43:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751168AbaDZBn4 (ORCPT ); Fri, 25 Apr 2014 21:43:56 -0400 Received: from mail-pa0-f49.google.com ([209.85.220.49]:41120 "EHLO mail-pa0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750916AbaDZBn4 (ORCPT ); Fri, 25 Apr 2014 21:43:56 -0400 Received: by mail-pa0-f49.google.com with SMTP id lj1so3699184pab.8 for ; Fri, 25 Apr 2014 18:43:55 -0700 (PDT) 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; bh=XR3sUBxit8RinlMy0+F3bRkTwsRNkrjweiL7oAFgBHI=; b=yJx4tuzo8IEyo42FpVHYRE8IQLE/4u+3FPdzjuh3nH+5j5QUfY2RphygTCa5+hsFnl Ilp18dw3Klr6I71bcxfZ4AaC2CW+9VdFXJNFNvOcdGcZY+tMx16sRFQI4ILPuh0P85kD xseRN2NoZZUJpHeFIORVg7LJlnGZRw8IaKiJgwnmS1OhFLrlCt4oTOnRila+uvcvA6Gu 8xucvPTnlS/wSggVpnj2Rh06Re0q3o4j5mju+ZL2ROwDWLwGbxl5ugeU3fr/Qm91kGan bHnXcXB1uWJWN0EYdX5Cs16R+xfyK/xj0v70Xd2/N7OOjilY0gzdvzsW7G3VcT/aZV// 4FbA== X-Received: by 10.68.197.39 with SMTP id ir7mr8830021pbc.78.1398476635634; Fri, 25 Apr 2014 18:43:55 -0700 (PDT) Received: from localhost.localdomain (p11.5bird.com. [128.199.246.148]) by mx.google.com with ESMTPSA id gj9sm18943537pbc.7.2014.04.25.18.43.53 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 25 Apr 2014 18:43:54 -0700 (PDT) From: "Zhao, Gang" To: Cc: Johannes Berg Subject: [PATCH 1/2] mac80211: beautify the code Date: Sat, 26 Apr 2014 09:43:40 +0800 Message-Id: <2c511530891bb91f1898a9ae09fed1628043192c.1398476191.git.gamerh2o@gmail.com> X-Mailer: git-send-email 1.9.0 In-Reply-To: <1398440262.4152.21.camel@jlt4.sipsolutions.net> References: <1398440262.4152.21.camel@jlt4.sipsolutions.net> 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_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, 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 ieee80211_assign_chanctx() checks if local->use_chanctx is true, so the two code block related to ieee80211_assign_chanctx() can be moved into above if clause, emphasize that these code are executed only if local->use_chanctx is true. Signed-off-by: Zhao, Gang --- net/mac80211/util.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/net/mac80211/util.c b/net/mac80211/util.c index 7a376f8..cafbae7 100644 --- a/net/mac80211/util.c +++ b/net/mac80211/util.c @@ -1565,17 +1565,17 @@ int ieee80211_reconfig(struct ieee80211_local *local) list_for_each_entry(ctx, &local->chanctx_list, list) WARN_ON(drv_add_chanctx(local, ctx)); mutex_unlock(&local->chanctx_mtx); - } - list_for_each_entry(sdata, &local->interfaces, list) { - if (!ieee80211_sdata_running(sdata)) - continue; - ieee80211_assign_chanctx(local, sdata); - } + list_for_each_entry(sdata, &local->interfaces, list) { + if (!ieee80211_sdata_running(sdata)) + continue; + ieee80211_assign_chanctx(local, sdata); + } - sdata = rtnl_dereference(local->monitor_sdata); - if (sdata && ieee80211_sdata_running(sdata)) - ieee80211_assign_chanctx(local, sdata); + sdata = rtnl_dereference(local->monitor_sdata); + if (sdata && ieee80211_sdata_running(sdata)) + ieee80211_assign_chanctx(local, sdata); + } /* add STAs back */ mutex_lock(&local->sta_mtx);