From patchwork Mon Nov 24 13:15:08 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Kazior X-Patchwork-Id: 5366501 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 7F3E9C11AD for ; Mon, 24 Nov 2014 13:28:25 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id ABA2A203F4 for ; Mon, 24 Nov 2014 13:28:24 +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 D43A2203B6 for ; Mon, 24 Nov 2014 13:28:23 +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 1Xstgc-0006WQ-DN; Mon, 24 Nov 2014 13:28:14 +0000 Received: from mail-wi0-x229.google.com ([2a00:1450:400c:c05::229]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1XstgV-00066Y-Bm for ath10k@lists.infradead.org; Mon, 24 Nov 2014 13:28:08 +0000 Received: by mail-wi0-f169.google.com with SMTP id r20so8836423wiv.2 for ; Mon, 24 Nov 2014 05:27:41 -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=3ydCPkV6kwV4H9PwhFYLhKU0LnWX48Mafn0sThlc8p88lbTUm0/FB7lZFnKjx8qoHQ 3w7SC6OS39UF1tlbornIGhxzvU2obuqRERoNLvzs6arROHejg+rBDugvwjWR0SWzbB1T kTKnoQFgI8jUpl8T+F+HCaZ9XCvy/7jJWugWo= 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=hHTz2Ci+jeP6vgIGoWgjErYRyS85FxOwwjzQYv1d6Jbunv8yqCP9YTo2WgMcnjsDgP V1t2e+NtyaQ7/SiZUZ1uVIL1gSwO88WDrN+olyrwh3/sB8ryr3/TaiyLfNBA02jEPF1T BLhnHdjuhMT0DXsZKvsddeI/wDHI1Wcsa/fpMJoudk4zAN+1aGnkRFB87yR9BwZE8JK+ tVEPvjMTQL4Pc5Q+aWhgosrxIJmnEVZaD5c7SPljJNufDn/nNgX5GULPb/Ac75RD4YeJ YCUHCb7Q6QvXI79+XNy4GLFSuzw9Y39znLxm1ujRZXpUZwwgA7mcroOdcRsSivZ9emVr uHqw== X-Gm-Message-State: ALoCoQm4rL3G4ePFoARzjyf9Gq2e8yygLgTMvh29bI6oreze3GVg0YTpgq6ZJvI1i3fYpncHFRueisiaYYss+eCkGoDgQFIx21Wt7Ka43m4oBZuzK8TCj16RqYDLZHJJKvAhDCkD/hR+H27VT41NEE8jT3PC+SPuFvMHVsLOfhogc0uRqc8kxxI= X-Received: by 10.194.83.8 with SMTP id m8mr34511917wjy.58.1416835660946; Mon, 24 Nov 2014 05:27:40 -0800 (PST) Received: from localhost.localdomain ([91.198.246.8]) by mx.google.com with ESMTPSA id vy7sm21026912wjc.27.2014.11.24.05.27.40 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 24 Nov 2014 05:27:40 -0800 (PST) From: Michal Kazior To: ath10k@lists.infradead.org Subject: [PATCH 2/3] ath10k: clean up num_peers locking Date: Mon, 24 Nov 2014 14:15:08 +0100 Message-Id: <1416834909-7130-2-git-send-email-michal.kazior@tieto.com> X-Mailer: git-send-email 1.8.5.3 In-Reply-To: <1416834909-7130-1-git-send-email-michal.kazior@tieto.com> References: <1416834909-7130-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-20141124_052807_678129_1579AE96 X-CRM114-Status: GOOD ( 11.80 ) 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; } /************************/