Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp720287imm; Sat, 14 Jul 2018 10:44:28 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeQzi0KnsuDE76CnC0i3L9NHqFdRt34m7g7DgvDfmNPQePzAWhao13V6eo6r2/YJ2ViCqS6 X-Received: by 2002:a62:748:: with SMTP id b69-v6mr11817320pfd.177.1531590268556; Sat, 14 Jul 2018 10:44:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531590268; cv=none; d=google.com; s=arc-20160816; b=h3nYsfSfLtxcporcnchMkX0pBqrvOVwFAAzFr5Ig66l3Xd52kRNc607hVJ8Xw1s5oc Y1HLlfA9YgD5ypGskF0DiwpHcpLp2gE71V5w9ctTy1yps9zRyyNxxPJvX3qX1KVV3cAn PKtVgir1nB4aYsY3B38tqLXK6SolSlUb1mZ+cwGuB+IXfAwLIzV6YtlKxgbis4o5Ag26 bJeo5HSbVYGsWnWF+N7pQLfLlgx0J0IAHnTCo8cluRhByVFneohRuxpnHY5SjE837kdb QtaSuJ4PHlLsw+Yvg1FAX/QHdGhOZO9oAsB/VGTClZwcKweRuZBaIspw9gQ1J8DUTYpA lkIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=hhM8H/XsLB92reF+BJyLV7pQwXCn8QVu+202wRlLLII=; b=WT5oJVRpySetx1DR28LeFRDi5GaxtSGFtUKBLUkmHuCBBAxxCo5/t2LMxTqJs6Ty/B A+yLi2nVBZHPmgUI4pQjld5pmerwhqEk3PQKmGfsjywIlfi6o2mI5/lpbuilZT/sGmmp ICt4Yyav0vVC7jIkWdtZeR33b3mAfYZ+db2OYQVYW8OjOIPXbfYkVcYvT8DLYO333v/T FgiQO8CkkBQv6dI2B/OjSUKFC+gFqUfXub3K40tmZXuaFLeBgJn4LTSxXUxkW29DZtt+ bQWUEDjr39RJ/WjZtAlRm7gzP3Mgdp+skZGxlhFbXa1wyrsp5el7Wfeel+nUTsHUZaYC ysDQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d10-v6si28337403pfg.258.2018.07.14.10.44.13; Sat, 14 Jul 2018 10:44:28 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731051AbeGNSD1 (ORCPT + 99 others); Sat, 14 Jul 2018 14:03:27 -0400 Received: from www.osadl.org ([62.245.132.105]:37008 "EHLO www.osadl.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727193AbeGNSD1 (ORCPT ); Sat, 14 Jul 2018 14:03:27 -0400 Received: from debian01.hofrr.at (178.115.242.59.static.drei.at [178.115.242.59] (may be forged)) by www.osadl.org (8.13.8/8.13.8/OSADL-2007092901) with ESMTP id w6EHdBWi006211; Sat, 14 Jul 2018 19:39:11 +0200 From: Nicholas Mc Guire To: Kalle Valo Cc: "David S. Miller" , ath10k@lists.infradead.org, linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Nicholas Mc Guire Subject: [PATCH] ath10k: htt_tx: move lock into id_get function Date: Sat, 14 Jul 2018 19:38:20 +0200 Message-Id: <1531589900-29220-1-git-send-email-hofrat@osadl.org> X-Mailer: git-send-email 2.1.4 X-Spam-Status: No, score=-4.2 required=6.0 tests=BAYES_00,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on www.osadl.org Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This is only code refactoring as all call sites of ath10k_htt_tx_alloc_msdu_id() take the same lock it can be moved into the id_get function and the assertion dropped. Signed-off-by: Nicholas Mc Guire --- Found during code review Patch was compile tested with: x86_64_defconfig + CONFIG_ATH10K=y (with a number of sparse warnings "expression using sizeof(void)") Patch is against 4.18-rc4 (localversion-next is next-20180713) drivers/net/wireless/ath/ath10k/htt_tx.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/drivers/net/wireless/ath/ath10k/htt_tx.c b/drivers/net/wireless/ath/ath10k/htt_tx.c index 89157c5..8a2aa2d 100644 --- a/drivers/net/wireless/ath/ath10k/htt_tx.c +++ b/drivers/net/wireless/ath/ath10k/htt_tx.c @@ -208,10 +208,10 @@ int ath10k_htt_tx_alloc_msdu_id(struct ath10k_htt *htt, struct sk_buff *skb) struct ath10k *ar = htt->ar; int ret; - lockdep_assert_held(&htt->tx_lock); - + spin_lock_bh(&htt->tx_lock); ret = idr_alloc(&htt->pending_tx, skb, 0, htt->max_num_pending_tx, GFP_ATOMIC); + spin_unlock_bh(&htt->tx_lock); ath10k_dbg(ar, ATH10K_DBG_HTT, "htt tx alloc msdu_id %d\n", ret); @@ -1077,9 +1077,7 @@ int ath10k_htt_mgmt_tx(struct ath10k_htt *htt, struct sk_buff *msdu) len += sizeof(cmd->hdr); len += sizeof(cmd->mgmt_tx); - spin_lock_bh(&htt->tx_lock); res = ath10k_htt_tx_alloc_msdu_id(htt, msdu); - spin_unlock_bh(&htt->tx_lock); if (res < 0) goto err; @@ -1161,9 +1159,7 @@ static int ath10k_htt_tx_32(struct ath10k_htt *htt, struct htt_msdu_ext_desc *ext_desc = NULL; struct htt_msdu_ext_desc *ext_desc_t = NULL; - spin_lock_bh(&htt->tx_lock); res = ath10k_htt_tx_alloc_msdu_id(htt, msdu); - spin_unlock_bh(&htt->tx_lock); if (res < 0) goto err; @@ -1363,9 +1359,7 @@ static int ath10k_htt_tx_64(struct ath10k_htt *htt, struct htt_msdu_ext_desc_64 *ext_desc = NULL; struct htt_msdu_ext_desc_64 *ext_desc_t = NULL; - spin_lock_bh(&htt->tx_lock); res = ath10k_htt_tx_alloc_msdu_id(htt, msdu); - spin_unlock_bh(&htt->tx_lock); if (res < 0) goto err; -- 2.1.4