Linux IEEE 802.15.4 and 6LoWPAN development
 help / color / mirror / Atom feed
* [PATCH] at86rf230: Add macro for TRX STATE MASK
@ 2015-04-24  7:44 Christoffer Holmstedt
  2015-04-27  6:31 ` Alexander Aring
  0 siblings, 1 reply; 2+ messages in thread
From: Christoffer Holmstedt @ 2015-04-24  7:44 UTC (permalink / raw)
  To: Alexander Aring, linux-wpan; +Cc: Christoffer Holmstedt

Instead of using the 'magic' number of 0x1f the TRX_STATE_MASK macro is
introduced.

Signed-off-by: Christoffer Holmstedt <christoffer.holmstedt@gmail.com>
---
 drivers/net/ieee802154/at86rf230.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ieee802154/at86rf230.c b/drivers/net/ieee802154/at86rf230.c
index 38026650c038..684488acc65d 100644
--- a/drivers/net/ieee802154/at86rf230.c
+++ b/drivers/net/ieee802154/at86rf230.c
@@ -292,6 +292,8 @@ struct at86rf230_local {
 #define STATE_BUSY_RX_AACK_NOCLK 0x1E
 #define STATE_TRANSITION_IN_PROGRESS 0x1F
 
+#define TRX_STATE_MASK		(0x1F)
+
 #define AT86RF2XX_NUMREGS 0x3F
 
 static void
@@ -509,7 +511,7 @@ at86rf230_async_state_assert(void *context)
 	struct at86rf230_state_change *ctx = context;
 	struct at86rf230_local *lp = ctx->lp;
 	const u8 *buf = ctx->buf;
-	const u8 trx_state = buf[1] & 0x1f;
+	const u8 trx_state = buf[1] & TRX_STATE_MASK;
 
 	/* Assert state change */
 	if (trx_state != ctx->to_state) {
@@ -667,7 +669,7 @@ at86rf230_async_state_change_start(void *context)
 	struct at86rf230_state_change *ctx = context;
 	struct at86rf230_local *lp = ctx->lp;
 	u8 *buf = ctx->buf;
-	const u8 trx_state = buf[1] & 0x1f;
+	const u8 trx_state = buf[1] & TRX_STATE_MASK;
 	int rc;
 
 	/* Check for "possible" STATE_TRANSITION_IN_PROGRESS */
-- 
1.9.1


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

* Re: [PATCH] at86rf230: Add macro for TRX STATE MASK
  2015-04-24  7:44 [PATCH] at86rf230: Add macro for TRX STATE MASK Christoffer Holmstedt
@ 2015-04-27  6:31 ` Alexander Aring
  0 siblings, 0 replies; 2+ messages in thread
From: Alexander Aring @ 2015-04-27  6:31 UTC (permalink / raw)
  To: Christoffer Holmstedt; +Cc: linux-wpan

On Fri, Apr 24, 2015 at 09:44:49AM +0200, Christoffer Holmstedt wrote:
> Instead of using the 'magic' number of 0x1f the TRX_STATE_MASK macro is
> introduced.
> 
> Signed-off-by: Christoffer Holmstedt <christoffer.holmstedt@gmail.com>

Acked-by: Alexander Aring <alex.aring@gmail.com>

- Alex

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

end of thread, other threads:[~2015-04-27  6:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-24  7:44 [PATCH] at86rf230: Add macro for TRX STATE MASK Christoffer Holmstedt
2015-04-27  6:31 ` Alexander Aring

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