From patchwork Tue Nov 25 14:16:04 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Kazior X-Patchwork-Id: 5379961 Return-Path: X-Original-To: patchwork-ath10k@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 41018C11AC for ; Tue, 25 Nov 2014 14:29:07 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9BC93200DF for ; Tue, 25 Nov 2014 14:29:02 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id F38C220145 for ; Tue, 25 Nov 2014 14:28:57 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1XtH6q-0005Y6-1X; Tue, 25 Nov 2014 14:28:52 +0000 Received: from mail-wg0-x232.google.com ([2a00:1450:400c:c00::232]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1XtH6j-0005Ft-9F for ath10k@lists.infradead.org; Tue, 25 Nov 2014 14:28:47 +0000 Received: by mail-wg0-f50.google.com with SMTP id k14so1011118wgh.9 for ; Tue, 25 Nov 2014 06:28:18 -0800 (PST) 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=kIngmo68kKeekAYhqtm8yHCgEGcCrYqukZx28EiPqUY=; b=Tucs7dRMqgxnJA2RMXRSRpPPx72gjDfmLsKLdAjePXfKAfH3fRGdmrgiBDapE5SBCB 5JlnuCQv5K+42Vf5g9TEMP0eNh0/dZyVtlCeZA0ewLVETi+VgTC3nT8uXqaRqtHMNLOI 4XDxsA7QhqzyiikXN9isX41UIngKFEp/tPYDc= 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=kIngmo68kKeekAYhqtm8yHCgEGcCrYqukZx28EiPqUY=; b=Jl45Zc+Z2F1ClxO/SWjfLRYagTsI298E5SBda5oiYc5b2d2bMr9nwm8WFy+t+EVoBc 8mrRm31UbhBHbCfPFs0VvycaEtlaCuX0x7KFqsPxFkVpOLT1VP+2WQjrrJb1SLDTHaXN CoQgKOI/AacXwswlCIal/G2Oh/gSruhDZMD+83rJk0Qir12hYrSelZln7hYjHVYU8kRz RAIxJ9ie4Fa2KtoXZ6lsao93YAak9jfjR5+MvIvGMTZVhRT6czaq9Taq7IXaLbd5aaXU Ob8BT3j1Wmv2oi+Q/eXmG9dTEFRo9KYU5VEAtXuU8sXfFZPqHCu2xRHGkJ2hKejRdUh/ 7/Cw== X-Gm-Message-State: ALoCoQnjk5tetaHOXnXootPNGovCD3ci9yLofVq14iNzayQiQJp0RIqMUGNI8X4PaVYYKyo8eoRp+xOnGIp2LSFd002V04ZFjKcC3810eKKOk3/GEmD5MPFufFQDvFHxCLGjNSTqSuQ75Sjj7/kK4q9jQQ+nKHd1RtdPWXvoYU5/83xIDzRkVt0= X-Received: by 10.180.211.166 with SMTP id nd6mr31393145wic.81.1416925698874; Tue, 25 Nov 2014 06:28:18 -0800 (PST) Received: from localhost.localdomain ([91.198.246.8]) by mx.google.com with ESMTPSA id u9sm2101674wjy.37.2014.11.25.06.28.18 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 25 Nov 2014 06:28:18 -0800 (PST) From: Michal Kazior To: ath10k@lists.infradead.org Subject: [PATCH v2 2/3] ath10k: clean up num_peers locking Date: Tue, 25 Nov 2014 15:16:04 +0100 Message-Id: <1416924965-28216-2-git-send-email-michal.kazior@tieto.com> X-Mailer: git-send-email 1.8.5.3 In-Reply-To: <1416924965-28216-1-git-send-email-michal.kazior@tieto.com> References: <1416834909-7130-1-git-send-email-michal.kazior@tieto.com> <1416924965-28216-1-git-send-email-michal.kazior@tieto.com> X-DomainID: tieto.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20141125_062845_545235_27FCCEB7 X-CRM114-Status: GOOD ( 12.00 ) X-Spam-Score: -0.8 (/) Cc: linux-wireless@vger.kernel.org, Michal Kazior X-BeenThere: ath10k@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "ath10k" Errors-To: ath10k-bounces+patchwork-ath10k=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_LOW, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 var was supposed to be protected by data_lock but it wasn't so in all instances. It's actually not necessary to have a spinlock protected num_peers so drop it. All instances of num_peers are already within conf_mutex sections so use that. Signed-off-by: Michal Kazior --- drivers/net/wireless/ath/ath10k/core.h | 2 +- drivers/net/wireless/ath/ath10k/mac.c | 8 +++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/net/wireless/ath/ath10k/core.h b/drivers/net/wireless/ath/ath10k/core.h index 8f86bd3..be7e50b6 100644 --- a/drivers/net/wireless/ath/ath10k/core.h +++ b/drivers/net/wireless/ath/ath10k/core.h @@ -560,7 +560,7 @@ struct ath10k { struct list_head peers; wait_queue_head_t peer_mapping_wq; - /* number of created peers; protected by data_lock */ + /* protected by conf_mutex */ int num_peers; struct work_struct offchan_tx_work; diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c index 7b5a888..3312e75 100644 --- a/drivers/net/wireless/ath/ath10k/mac.c +++ b/drivers/net/wireless/ath/ath10k/mac.c @@ -339,9 +339,8 @@ static int ath10k_peer_create(struct ath10k *ar, u32 vdev_id, const u8 *addr) addr, vdev_id, ret); return ret; } - spin_lock_bh(&ar->data_lock); + ar->num_peers++; - spin_unlock_bh(&ar->data_lock); return 0; } @@ -432,9 +431,7 @@ static int ath10k_peer_delete(struct ath10k *ar, u32 vdev_id, const u8 *addr) if (ret) return ret; - spin_lock_bh(&ar->data_lock); ar->num_peers--; - spin_unlock_bh(&ar->data_lock); return 0; } @@ -471,8 +468,9 @@ static void ath10k_peer_cleanup_all(struct ath10k *ar) list_del(&peer->list); kfree(peer); } - ar->num_peers = 0; spin_unlock_bh(&ar->data_lock); + + ar->num_peers = 0; } /************************/