From 7332fcb82a15730f4b0bfa65db074c505c0ffc1a Mon Sep 17 00:00:00 2001 From: Alexander Aring Date: Sat, 15 Mar 2014 09:29:03 +0100 Subject: [PATCH] at86rf230: fix unexpected state change This patch fix a unexpected state change for the at86rf231 chip. We can't change into STATE_FORCE_TX_ON while the chip is in one of SLEEP, P_ON, RESET, TRX_OFF, and all *_NOCLK states. In this case we are in the TRX_OFF state. See datasheet [1] page 71 for more information. Without this patch you will get the following message on a at86rf231 device: [ 20.065218] unexpected state change: 8, asked for 4 [ 20.070527] ------------[ cut here ]------------ [ 20.075414] WARNING: CPU: 0 PID: 160 at net/mac802154/ieee802154_dev.c:43 mac802154_slave_open+0x70/0xb8() [ 20.085594] Modules linked in: autofs4 [ 20.089667] CPU: 0 PID: 160 Comm: ifconfig Not tainted 3.14.0-20140108-1-00993-g905c192 #162 [ 20.098612] [] (unwind_backtrace) from [] (show_stack+0x10/0x14) [ 20.106819] [] (show_stack) from [] (warn_slowpath_common+0x60/0x80) [ 20.115311] [] (warn_slowpath_common) from [] (warn_slowpath_null+0x18/0x20) [ 20.124590] [] (warn_slowpath_null) from [] (mac802154_slave_open+0x70/0xb8) [ 20.133880] [] (mac802154_slave_open) from [] (__dev_open+0xa8/0x108) [ 20.142553] [] (__dev_open) from [] (__dev_change_flags+0x8c/0x148) [ 20.151051] [] (__dev_change_flags) from [] (dev_change_flags+0x18/0x48) [ 20.159968] [] (dev_change_flags) from [] (devinet_ioctl+0x2b0/0x63c) [ 20.168623] [] (devinet_ioctl) from [] (sock_ioctl+0x23c/0x29c) [ 20.176727] [] (sock_ioctl) from [] (do_vfs_ioctl+0x4a8/0x578) [ 20.184671] [] (do_vfs_ioctl) from [] (SyS_ioctl+0x4c/0x78) [ 20.192402] [] (SyS_ioctl) from [] (ret_fast_syscall+0x0/0x48) [ 20.200392] ---[ end trace 9a34542f4ea08e47 ]--- This patch was tested on at86rf231 and at86rf212. [1] http://www.atmel.com/images/doc8111.pdf Signed-off-by: Alexander Aring Signed-off-by: David S. Miller --- drivers/net/ieee802154/at86rf230.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ieee802154/at86rf230.c b/drivers/net/ieee802154/at86rf230.c index ae38a98d072e..ad296bc86e69 100644 --- a/drivers/net/ieee802154/at86rf230.c +++ b/drivers/net/ieee802154/at86rf230.c @@ -574,7 +574,7 @@ at86rf230_start(struct ieee802154_dev *dev) if (rc) return rc; - rc = at86rf230_state(dev, STATE_FORCE_TX_ON); + rc = at86rf230_state(dev, STATE_TX_ON); if (rc) return rc; -- 2.34.1