Skip to contentSkip to conversation

at86rf230: cleanups

PATCH Applied Alexander Aring 3 participants 8 messages Dec 15, 2014 – Dec 18, 2014

Subsystems (2)
lore
Share & tools
lore

Alexander Aring

author maintainer
#0 lore raw

v2 cover at86rf230: cleanups

This patch series contains various cleanups for the at86rf230. Except patch 3/5 which contains a fix for a rarely error handling. Because this error handling is very rarely and should only happens if something is wrong with the spi controller, it's okay to fix it in next.

- Alex

changes since v2:
- make patch 1/5 "at86rf230: remove if branch" more human readable.

Alexander Aring (5):
at86rf230: remove if branch
at86rf230: make at86rf230_async_error inline
at86rf230: fix context pointer handling
at86rf230: cleanup check on trac status
at86rf230: remove unnecessary assign

 drivers/net/ieee802154/at86rf230.c | 18 ++++++------------
 1 file changed, 6 insertions(+), 12 deletions(-)
Signature · 1 line
2.1.3
author maintainer
#1 lore raw

PATCH v2 1/5 at86rf230: remove if branch

This patch removes an unnecessary if branch inside the tx complete handler.

---
 drivers/net/ieee802154/at86rf230.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/net/ieee802154/at86rf230.c +1 -4
index 1c01356..434efc5 100644
@@ -715,10 +715,7 @@ at86rf230_tx_complete(void *context)
 
 	enable_irq(lp->spi->irq);
 
-	if (lp->max_frame_retries <= 0)
-		ieee802154_xmit_complete(lp->hw, skb, true);
-	else
-		ieee802154_xmit_complete(lp->hw, skb, false);
+	ieee802154_xmit_complete(lp->hw, skb, !lp->tx_aret);
 }
 
 static void
Signature · 1 line
2.1.3
Reviewed-by on v2 1/5
#2 lore raw

Re: [PATCHv2 bluetooth-next 1/5] at86rf230: remove if branch

Hello.

Quoted 16 lines · Alexander Aring

This patch removes an unnecessary if branch inside the tx complete handler.

---
  drivers/net/ieee802154/at86rf230.c | 5 +----
  1 file changed, 1 insertion(+), 4 deletions(-)
drivers/net/ieee802154/at86rf230.c +0 -0
index 1c01356..434efc5 100644
@@ -715,10 +715,7 @@ at86rf230_tx_complete(void *context)
 

drivers/net/ieee802154/at86rf230.c at86rf230_tx_complete(void *context) · line 721

Quoted 10 lines
drivers/net/ieee802154/at86rf230.c +1 -4
  	enable_irq(lp->spi->irq);
 
-	if (lp->max_frame_retries <= 0)
-		ieee802154_xmit_complete(lp->hw, skb, true);
-	else
-		ieee802154_xmit_complete(lp->hw, skb, false);
+	ieee802154_xmit_complete(lp->hw, skb, !lp->tx_aret);
  }
 
  static void

Thanks!

regards
Stefan Schmidt

author maintainer
#3 lore raw

PATCH v2 2/5 at86rf230: make at86rf230_async_error inline

In reply to Alexander Aring

This patch makes the at86rf230_async_error inline. This function is small enough to handle inline.

---
 drivers/net/ieee802154/at86rf230.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ieee802154/at86rf230.c +1 -1
index 434efc5..8ca4ef6 100644
@@ -450,7 +450,7 @@ at86rf230_async_error_recover(void *context)
 	ieee802154_wake_queue(lp->hw);
 }
 
-static void
+static inline void
 at86rf230_async_error(struct at86rf230_local *lp,
 		      struct at86rf230_state_change *ctx, int rc)
 {
Signature · 1 line
2.1.3
author maintainer
#4 lore raw

PATCH v2 3/5 at86rf230: fix context pointer handling

In reply to Alexander Aring

This patch changes the context pointer to the parameter given one inside function at86rf230_async_state_change_start. This could occur problem if context isn't pointed to lp->state.

---
 drivers/net/ieee802154/at86rf230.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ieee802154/at86rf230.c +1 -1
index 8ca4ef6..c39466e 100644
@@ -655,7 +655,7 @@ at86rf230_async_state_change_start(void *context)
 		if (ctx->irq_enable)
 			enable_irq(lp->spi->irq);
 
-		at86rf230_async_error(lp, &lp->state, rc);
+		at86rf230_async_error(lp, ctx, rc);
 	}
 }
 
Signature · 1 line
2.1.3
author maintainer
#5 lore raw

PATCH v2 4/5 at86rf230: cleanup check on trac status

In reply to Alexander Aring
---
 drivers/net/ieee802154/at86rf230.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/net/ieee802154/at86rf230.c +3 -5
index c39466e..9f61748 100644
@@ -750,13 +750,11 @@ at86rf230_tx_trac_check(void *context)
 	 * to STATE_FORCE_TRX_OFF then STATE_TX_ON to recover the transceiver
 	 * state to TX_ON.
 	 */
-	if (trac) {
+	if (trac)
 		at86rf230_async_state_change(lp, ctx, STATE_FORCE_TRX_OFF,
 					     at86rf230_tx_trac_error, true);
-		return;
-	}
-
-	at86rf230_tx_on(context);
+	else
+		at86rf230_tx_on(context);
 }
 
 
Signature · 1 line
2.1.3
author maintainer
#6 lore raw

PATCH v2 5/5 at86rf230: remove unnecessary assign

In reply to Alexander Aring

The attribute extra_tx_headroom should already be zero.

---
 drivers/net/ieee802154/at86rf230.c | 1 -
 1 file changed, 1 deletion(-)
drivers/net/ieee802154/at86rf230.c +0 -1
index 9f61748..577b24e 100644
@@ -1405,7 +1405,6 @@ at86rf230_detect_device(struct at86rf230_local *lp)
 		return -EINVAL;
 	}
 
-	lp->hw->extra_tx_headroom = 0;
 	lp->hw->flags = IEEE802154_HW_TX_OMIT_CKSUM | IEEE802154_HW_AACK |
 			IEEE802154_HW_TXPOWER | IEEE802154_HW_ARET |
 			IEEE802154_HW_AFILT | IEEE802154_HW_PROMISCUOUS;
Signature · 1 line
2.1.3
#7 lore raw
In reply to Alexander Aring

Hi Alex,

Quoted 18 lines

This patch series contains various cleanups for the at86rf230. Except patch 3/5 which contains a fix for a rarely error handling. Because this error handling is very rarely and should only happens if something is wrong with the spi controller, it's okay to fix it in next.

- Alex

changes since v2:
- make patch 1/5 "at86rf230: remove if branch" more human readable.

Alexander Aring (5):
at86rf230: remove if branch
at86rf230: make at86rf230_async_error inline
at86rf230: fix context pointer handling
at86rf230: cleanup check on trac status
at86rf230: remove unnecessary assign

Quoted 2 lines

drivers/net/ieee802154/at86rf230.c | 18 ++++++------------

1 file changed, 6 insertions(+), 12 deletions(-)

I applied patches 1-3 and 5 to bluetooth-next tree.

The patch 4 does not apply and so please re-send a new version.

Regards

Marcel