All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ath10k: htt_tx: move lock into id_get function
@ 2018-07-14 17:38 ` Nicholas Mc Guire
  0 siblings, 0 replies; 5+ messages in thread
From: Nicholas Mc Guire @ 2018-07-14 17:38 UTC (permalink / raw)
  To: Kalle Valo
  Cc: David S. Miller, ath10k, linux-wireless, netdev, linux-kernel,
	Nicholas Mc Guire

 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 <hofrat@osadl.org>
---
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

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH] ath10k: htt_tx: move lock into id_get function
@ 2018-07-14 17:38 ` Nicholas Mc Guire
  0 siblings, 0 replies; 5+ messages in thread
From: Nicholas Mc Guire @ 2018-07-14 17:38 UTC (permalink / raw)
  To: Kalle Valo
  Cc: netdev, linux-wireless, linux-kernel, ath10k, Nicholas Mc Guire,
	David S. Miller

 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 <hofrat@osadl.org>
---
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


_______________________________________________
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] ath10k: htt_tx: move lock into id_get function
  2018-07-14 17:38 ` Nicholas Mc Guire
  (?)
@ 2018-07-30 17:59 ` Kalle Valo
  -1 siblings, 0 replies; 5+ messages in thread
From: Kalle Valo @ 2018-07-30 17:59 UTC (permalink / raw)
  To: Nicholas Mc Guire
  Cc: David S. Miller, ath10k, linux-wireless, netdev, linux-kernel,
	Nicholas Mc Guire

Nicholas Mc Guire <hofrat@osadl.org> wrote:

> 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 <hofrat@osadl.org>
> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>

Patch applied to ath-next branch of ath.git, thanks.

e82f57c8b970 ath10k: htt_tx: move lock into id_get function

-- 
https://patchwork.kernel.org/patch/10524837/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] ath10k: htt_tx: move lock into id_get function
  2018-07-14 17:38 ` Nicholas Mc Guire
@ 2018-07-30 17:59   ` Kalle Valo
  -1 siblings, 0 replies; 5+ messages in thread
From: Kalle Valo @ 2018-07-30 17:59 UTC (permalink / raw)
  To: Nicholas Mc Guire
  Cc: netdev, linux-wireless, linux-kernel, ath10k, Nicholas Mc Guire,
	David S. Miller

Nicholas Mc Guire <hofrat@osadl.org> wrote:

> 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 <hofrat@osadl.org>
> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>

Patch applied to ath-next branch of ath.git, thanks.

e82f57c8b970 ath10k: htt_tx: move lock into id_get function

-- 
https://patchwork.kernel.org/patch/10524837/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] ath10k: htt_tx: move lock into id_get function
@ 2018-07-30 17:59   ` Kalle Valo
  0 siblings, 0 replies; 5+ messages in thread
From: Kalle Valo @ 2018-07-30 17:59 UTC (permalink / raw)
  To: Nicholas Mc Guire
  Cc: netdev, linux-wireless, linux-kernel, ath10k, David S. Miller

Nicholas Mc Guire <hofrat@osadl.org> wrote:

> 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 <hofrat@osadl.org>
> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>

Patch applied to ath-next branch of ath.git, thanks.

e82f57c8b970 ath10k: htt_tx: move lock into id_get function

-- 
https://patchwork.kernel.org/patch/10524837/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches


_______________________________________________
ath10k mailing list
ath10k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath10k

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-07-30 19:35 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-14 17:38 [PATCH] ath10k: htt_tx: move lock into id_get function Nicholas Mc Guire
2018-07-14 17:38 ` Nicholas Mc Guire
2018-07-30 17:59 ` Kalle Valo
2018-07-30 17:59 ` Kalle Valo
2018-07-30 17:59   ` Kalle Valo

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.