Historical ath9k-devel archives
 help / color / mirror / Atom feed
* [ath9k-devel] [PATCH 0/7] ath10k: non-functional cleanups
@ 2013-04-18  8:20 Michal Kazior
  2013-04-18  8:20 ` [ath9k-devel] [PATCH 1/7] ath10k: fix code style Michal Kazior
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: Michal Kazior @ 2013-04-18  8:20 UTC (permalink / raw)
  To: ath9k-devel

Michal Kazior (7):
  ath10k: fix code style
  ath10k: use if() instead of ternary operator
  ath10k: remove unnecessary void cast
  ath10k: kill WARN_ONs in htt_rx.c
  ath10k: use macros instead of if() for value range limiting
  ath10k: use ath10k_warn() instead of WARN()
  ath10k: remove old function prototype

 drivers/net/wireless/ath/ath10k/bmi.c    |   18 +++++++++---------
 drivers/net/wireless/ath/ath10k/core.h   |    1 -
 drivers/net/wireless/ath/ath10k/htc.c    |    9 +++++----
 drivers/net/wireless/ath/ath10k/htt_rx.c |   21 ++++++++++++++-------
 drivers/net/wireless/ath/ath10k/mac.c    |   10 ++++------
 drivers/net/wireless/ath/ath10k/wmi.c    |    3 ++-
 6 files changed, 34 insertions(+), 28 deletions(-)

-- 
1.7.9.5

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

* [ath9k-devel] [PATCH 1/7] ath10k: fix code style
  2013-04-18  8:20 [ath9k-devel] [PATCH 0/7] ath10k: non-functional cleanups Michal Kazior
@ 2013-04-18  8:20 ` Michal Kazior
  2013-04-18  8:21 ` [ath9k-devel] [PATCH 2/7] ath10k: use if() instead of ternary operator Michal Kazior
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Michal Kazior @ 2013-04-18  8:20 UTC (permalink / raw)
  To: ath9k-devel

This fixes funky error handling.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
---
 drivers/net/wireless/ath/ath10k/bmi.c |   18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/bmi.c b/drivers/net/wireless/ath/ath10k/bmi.c
index b0149b7..0b3b509 100644
--- a/drivers/net/wireless/ath/ath10k/bmi.c
+++ b/drivers/net/wireless/ath/ath10k/bmi.c
@@ -282,14 +282,14 @@ int ath10k_bmi_fast_download(struct ath10k *ar,
 	if (unaligned_bytes)
 		ret = ath10k_bmi_lz_data(ar, &last_work, 4);
 
-	if (ret == 0) {
-		/*
-		 * Close compressed stream and open a new (fake) one.
-		 * This serves mainly to flush Target caches.
-		 */
-		ret = ath10k_bmi_lz_stream_start(ar, 0x00);
-		if (ret)
-			return ret;
-	}
+	if (ret != 0)
+		return ret;
+
+	/*
+	 * Close compressed stream and open a new (fake) one.
+	 * This serves mainly to flush Target caches.
+	 */
+	ret = ath10k_bmi_lz_stream_start(ar, 0x00);
+
 	return ret;
 }
-- 
1.7.9.5

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

* [ath9k-devel] [PATCH 2/7] ath10k: use if() instead of ternary operator
  2013-04-18  8:20 [ath9k-devel] [PATCH 0/7] ath10k: non-functional cleanups Michal Kazior
  2013-04-18  8:20 ` [ath9k-devel] [PATCH 1/7] ath10k: fix code style Michal Kazior
@ 2013-04-18  8:21 ` Michal Kazior
  2013-04-18  8:21 ` [ath9k-devel] [PATCH 3/7] ath10k: remove unnecessary void cast Michal Kazior
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Michal Kazior @ 2013-04-18  8:21 UTC (permalink / raw)
  To: ath9k-devel

Improves readability.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
---
 drivers/net/wireless/ath/ath10k/htc.c |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/htc.c b/drivers/net/wireless/ath/ath10k/htc.c
index 89b9dab..854d728 100644
--- a/drivers/net/wireless/ath/ath10k/htc.c
+++ b/drivers/net/wireless/ath/ath10k/htc.c
@@ -149,9 +149,10 @@ static int ath10k_htc_prepare_tx_skb(struct htc_endpoint *ep,
 
 	spin_lock_bh(&ep->target->htc_tx_lock);
 	hdr->seq_no = ep->seq_no++;
-	hdr->flags |= ath10k_htc_ep_need_credit_update(ep)
-			? HTC_FLAG_NEED_CREDIT_UPDATE
-			: 0;
+
+	if (ath10k_htc_ep_need_credit_update(ep))
+		hdr->flags |= HTC_FLAG_NEED_CREDIT_UPDATE;
+
 	spin_unlock_bh(&ep->target->htc_tx_lock);
 
 	return 0;
-- 
1.7.9.5

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

* [ath9k-devel] [PATCH 3/7] ath10k: remove unnecessary void cast
  2013-04-18  8:20 [ath9k-devel] [PATCH 0/7] ath10k: non-functional cleanups Michal Kazior
  2013-04-18  8:20 ` [ath9k-devel] [PATCH 1/7] ath10k: fix code style Michal Kazior
  2013-04-18  8:21 ` [ath9k-devel] [PATCH 2/7] ath10k: use if() instead of ternary operator Michal Kazior
@ 2013-04-18  8:21 ` Michal Kazior
  2013-04-18  8:21 ` [ath9k-devel] [PATCH 4/7] ath10k: kill WARN_ONs in htt_rx.c Michal Kazior
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Michal Kazior @ 2013-04-18  8:21 UTC (permalink / raw)
  To: ath9k-devel

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
---
 drivers/net/wireless/ath/ath10k/htc.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath10k/htc.c b/drivers/net/wireless/ath/ath10k/htc.c
index 854d728..b51f554 100644
--- a/drivers/net/wireless/ath/ath10k/htc.c
+++ b/drivers/net/wireless/ath/ath10k/htc.c
@@ -279,7 +279,7 @@ static struct sk_buff *ath10k_htc_get_skb(struct htc_target *target,
 
 static void ath10k_htc_send_work(struct work_struct *work)
 {
-	struct htc_endpoint *ep = container_of((void *)work,
+	struct htc_endpoint *ep = container_of(work,
 					struct htc_endpoint, send_work);
 	struct htc_target *target = ep->target;
 	struct sk_buff *skb;
-- 
1.7.9.5

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

* [ath9k-devel] [PATCH 4/7] ath10k: kill WARN_ONs in htt_rx.c
  2013-04-18  8:20 [ath9k-devel] [PATCH 0/7] ath10k: non-functional cleanups Michal Kazior
                   ` (2 preceding siblings ...)
  2013-04-18  8:21 ` [ath9k-devel] [PATCH 3/7] ath10k: remove unnecessary void cast Michal Kazior
@ 2013-04-18  8:21 ` Michal Kazior
  2013-04-18  8:21 ` [ath9k-devel] [PATCH 5/7] ath10k: use macros instead of if() for value range limiting Michal Kazior
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Michal Kazior @ 2013-04-18  8:21 UTC (permalink / raw)
  To: ath9k-devel

We should not use WARN_ON in this place as it may
spam the kernel logs easily. Instead use simple
prints.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
---
 drivers/net/wireless/ath/ath10k/htt_rx.c |   21 ++++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/htt_rx.c b/drivers/net/wireless/ath/ath10k/htt_rx.c
index 6fe273d..7c90a2c 100644
--- a/drivers/net/wireless/ath/ath10k/htt_rx.c
+++ b/drivers/net/wireless/ath/ath10k/htt_rx.c
@@ -219,7 +219,7 @@ static inline struct sk_buff *ath10k_htt_rx_netbuf_pop(struct htt_struct *htt)
 	spin_lock_bh(&htt->rx_ring.lock);
 
 	if (ath10k_htt_rx_ring_elems(htt) == 0)
-		WARN_ON(1);
+		ath10k_warn("htt rx ring is empty!\n");
 
 	idx = htt->rx_ring.sw_rd_idx.msdu_payld;
 	msdu = htt->rx_ring.buf.netbufs_ring[idx];
@@ -243,7 +243,7 @@ static int ath10k_htt_rx_amsdu_pop(struct htt_struct *htt,
 	struct htt_rx_desc *rx_desc;
 
 	if (ath10k_htt_rx_ring_elems(htt) == 0)
-		WARN_ON(1);
+		ath10k_warn("htt rx ring is empty!\n");
 
 	if (htt->rx_confused) {
 		ath10k_warn("%s: htt failure: cannot rx\n", __func__);
@@ -277,11 +277,12 @@ static int ath10k_htt_rx_amsdu_pop(struct htt_struct *htt,
 		 * To prevent the case that we handle a stale Rx descriptor,
 		 * just assert for now until we have a way to recover.
 		 */
-		if (WARN_ON(!(__le32_to_cpu(rx_desc->attention.flags)
-				& RX_ATTENTION_FLAGS_MSDU_DONE))) {
+		if (!(__le32_to_cpu(rx_desc->attention.flags)
+				& RX_ATTENTION_FLAGS_MSDU_DONE)) {
 			if (*head_msdu == msdu)
 				*head_msdu = NULL;
 			dev_kfree_skb_any(msdu);
+			ath10k_err("htt rx stopped. cannot recover\n");
 			htt->rx_confused = true;
 			break;
 		}
@@ -405,7 +406,11 @@ int ath10k_htt_rx_attach(struct htt_struct *htt)
 	struct timer_list *timer = &htt->rx_ring.refill_retry_timer;
 
 	htt->rx_ring.size = ath10k_htt_rx_ring_size(htt);
-	WARN_ON(!is_power_of_2(htt->rx_ring.size));
+	if (!is_power_of_2(htt->rx_ring.size)) {
+		ath10k_warn("htt rx ring size is not power of 2\n");
+		return -EINVAL;
+	}
+
 	htt->rx_ring.size_mask = htt->rx_ring.size - 1;
 
 	/*
@@ -928,7 +933,8 @@ more:
 	/* remove crypto trailer; we use rx desc for mic failure */
 	trim += ath10k_htt_rx_crypto_tail_len(info.encrypt_type);
 
-	if (WARN_ON(trim > info.skb->len)) {
+	if (trim > info.skb->len) {
+		ath10k_warn("htt rx fragment: trailer longer than the frame itself? drop\n");
 		dev_kfree_skb_any(info.skb);
 		goto end;
 	}
@@ -953,7 +959,8 @@ void ath10k_htt_t2h_msg_handler(void *context, struct sk_buff *skb)
 	struct htt_resp *resp = (struct htt_resp *)skb->data;
 
 	/* confirm alignment */
-	WARN_ON_ONCE((((unsigned long)skb->data) & 0x3) != 0);
+	if ((((unsigned long)skb->data) & 0x3) != 0)
+		ath10k_warn("unaligned htt message, expect trouble\n");
 
 	ath10k_dbg(ATH10K_DBG_HTT, "HTT RX, msg_type: 0x%0X\n", resp->hdr.msg_type);
 	switch (resp->hdr.msg_type) {
-- 
1.7.9.5

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

* [ath9k-devel] [PATCH 5/7] ath10k: use macros instead of if() for value range limiting
  2013-04-18  8:20 [ath9k-devel] [PATCH 0/7] ath10k: non-functional cleanups Michal Kazior
                   ` (3 preceding siblings ...)
  2013-04-18  8:21 ` [ath9k-devel] [PATCH 4/7] ath10k: kill WARN_ONs in htt_rx.c Michal Kazior
@ 2013-04-18  8:21 ` Michal Kazior
  2013-04-18  8:21 ` [ath9k-devel] [PATCH 6/7] ath10k: use ath10k_warn() instead of WARN() Michal Kazior
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Michal Kazior @ 2013-04-18  8:21 UTC (permalink / raw)
  To: ath9k-devel

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
---
 drivers/net/wireless/ath/ath10k/mac.c |   10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
index 1c9c048..3499858 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -2296,8 +2296,7 @@ static void ath10k_set_rts_iter(void *data, u8 *mac, struct ieee80211_vif *vif)
 	struct ath10k_vif *arvif = ath10k_vif_to_arvif(vif);
 	u32 rts = ar_iter->ar->hw->wiphy->rts_threshold;
 
-	if (rts > ATH10K_RTS_MAX)
-		rts = ATH10K_RTS_MAX;
+	rts = min_t(u32, rts, ATH10K_RTS_MAX);
 
 	ar_iter->ret = ath10k_wmi_vdev_set_param(ar_iter->ar, arvif->vdev_id,
 						 WMI_VDEV_PARAM_RTS_THRESHOLD,
@@ -2333,10 +2332,9 @@ static void ath10k_set_frag_iter(void *data, u8 *mac, struct ieee80211_vif *vif)
 	struct ath10k_vif *arvif = ath10k_vif_to_arvif(vif);
 	u32 frag = ar_iter->ar->hw->wiphy->frag_threshold;
 
-	if (frag > ATH10K_FRAGMT_THRESHOLD_MAX)
-		frag = ATH10K_FRAGMT_THRESHOLD_MAX;
-	else if (frag < ATH10K_FRAGMT_THRESHOLD_MIN)
-		frag = ATH10K_FRAGMT_THRESHOLD_MIN;
+	frag = clamp_t(u32, frag,
+		       ATH10K_FRAGMT_THRESHOLD_MIN,
+		       ATH10K_FRAGMT_THRESHOLD_MAX);
 
 	ar_iter->ret = ath10k_wmi_vdev_set_param(ar_iter->ar, arvif->vdev_id,
 						 WMI_VDEV_PARAM_FRAGMENTATION_THRESHOLD,
-- 
1.7.9.5

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

* [ath9k-devel] [PATCH 6/7] ath10k: use ath10k_warn() instead of WARN()
  2013-04-18  8:20 [ath9k-devel] [PATCH 0/7] ath10k: non-functional cleanups Michal Kazior
                   ` (4 preceding siblings ...)
  2013-04-18  8:21 ` [ath9k-devel] [PATCH 5/7] ath10k: use macros instead of if() for value range limiting Michal Kazior
@ 2013-04-18  8:21 ` Michal Kazior
  2013-04-18  8:21 ` [ath9k-devel] [PATCH 7/7] ath10k: remove old function prototype Michal Kazior
  2013-04-18 10:45 ` [ath9k-devel] [PATCH 0/7] ath10k: non-functional cleanups Kalle Valo
  7 siblings, 0 replies; 9+ messages in thread
From: Michal Kazior @ 2013-04-18  8:21 UTC (permalink / raw)
  To: ath9k-devel

Avoid spamming kernel logs.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
---
 drivers/net/wireless/ath/ath10k/wmi.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c
index ae30be3..d19d2cc 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -36,7 +36,8 @@ void ath10k_wmi_flush_tx(struct ath10k *ar)
 	if (ret == 0)
 		ret = -ETIMEDOUT;
 
-	WARN(ret < 0, "%s failed %d\n", __func__, ret);
+	if (ret < 0)
+		ath10k_warn("wmi flush failed (%d)\n", ret);
 }
 
 int ath10k_wmi_wait_for_service_ready(struct ath10k *ar)
-- 
1.7.9.5

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

* [ath9k-devel] [PATCH 7/7] ath10k: remove old function prototype
  2013-04-18  8:20 [ath9k-devel] [PATCH 0/7] ath10k: non-functional cleanups Michal Kazior
                   ` (5 preceding siblings ...)
  2013-04-18  8:21 ` [ath9k-devel] [PATCH 6/7] ath10k: use ath10k_warn() instead of WARN() Michal Kazior
@ 2013-04-18  8:21 ` Michal Kazior
  2013-04-18 10:45 ` [ath9k-devel] [PATCH 0/7] ath10k: non-functional cleanups Kalle Valo
  7 siblings, 0 replies; 9+ messages in thread
From: Michal Kazior @ 2013-04-18  8:21 UTC (permalink / raw)
  To: ath9k-devel

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
---
 drivers/net/wireless/ath/ath10k/core.h |    1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath10k/core.h b/drivers/net/wireless/ath/ath10k/core.h
index e689212..de47b41 100644
--- a/drivers/net/wireless/ath/ath10k/core.h
+++ b/drivers/net/wireless/ath/ath10k/core.h
@@ -386,5 +386,4 @@ void ath10k_core_destroy(struct ath10k *ar);
 int ath10k_core_register(struct ath10k *ar);
 void ath10k_core_unregister(struct ath10k *ar);
 
-void ath10k_remain_on_channel_reset(unsigned long ptr);
 #endif /* _CORE_H_ */
-- 
1.7.9.5

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

* [ath9k-devel] [PATCH 0/7] ath10k: non-functional cleanups
  2013-04-18  8:20 [ath9k-devel] [PATCH 0/7] ath10k: non-functional cleanups Michal Kazior
                   ` (6 preceding siblings ...)
  2013-04-18  8:21 ` [ath9k-devel] [PATCH 7/7] ath10k: remove old function prototype Michal Kazior
@ 2013-04-18 10:45 ` Kalle Valo
  7 siblings, 0 replies; 9+ messages in thread
From: Kalle Valo @ 2013-04-18 10:45 UTC (permalink / raw)
  To: ath9k-devel

Michal Kazior <michal.kazior@tieto.com> writes:

> Michal Kazior (7):
>   ath10k: fix code style
>   ath10k: use if() instead of ternary operator
>   ath10k: remove unnecessary void cast
>   ath10k: kill WARN_ONs in htt_rx.c
>   ath10k: use macros instead of if() for value range limiting
>   ath10k: use ath10k_warn() instead of WARN()
>   ath10k: remove old function prototype

Thanks, all seven applied.

-- 
Kalle Valo

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

end of thread, other threads:[~2013-04-18 10:45 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-18  8:20 [ath9k-devel] [PATCH 0/7] ath10k: non-functional cleanups Michal Kazior
2013-04-18  8:20 ` [ath9k-devel] [PATCH 1/7] ath10k: fix code style Michal Kazior
2013-04-18  8:21 ` [ath9k-devel] [PATCH 2/7] ath10k: use if() instead of ternary operator Michal Kazior
2013-04-18  8:21 ` [ath9k-devel] [PATCH 3/7] ath10k: remove unnecessary void cast Michal Kazior
2013-04-18  8:21 ` [ath9k-devel] [PATCH 4/7] ath10k: kill WARN_ONs in htt_rx.c Michal Kazior
2013-04-18  8:21 ` [ath9k-devel] [PATCH 5/7] ath10k: use macros instead of if() for value range limiting Michal Kazior
2013-04-18  8:21 ` [ath9k-devel] [PATCH 6/7] ath10k: use ath10k_warn() instead of WARN() Michal Kazior
2013-04-18  8:21 ` [ath9k-devel] [PATCH 7/7] ath10k: remove old function prototype Michal Kazior
2013-04-18 10:45 ` [ath9k-devel] [PATCH 0/7] ath10k: non-functional cleanups Kalle Valo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox