My patch "straighten out RX vs. TX synchronization" introduced one new
race condition and failed to properly synchronize state if interrupted.
This patch corrects these two problems:

- clear is_tx before calling at86rf230_start to switch to RX_ON
  (reported by Alexander Smirnov)
- re-synchronize at86rf230_xmit with interrupt/worker if
  wait_for_completion_interruptible is interrupted

This patch should be applied on top of the "straighten out RX vs. TX
synchronization" patch.

Signed-off-by: Werner Almesberger <wer...@almesberger.net>

---
 drivers/ieee802154/at86rf230.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/ieee802154/at86rf230.c b/drivers/ieee802154/at86rf230.c
index e84e295..556ebc4 100644
--- a/drivers/ieee802154/at86rf230.c
+++ b/drivers/ieee802154/at86rf230.c
@@ -396,17 +396,21 @@ at86rf230_xmit(struct ieee802154_dev *dev, struct sk_buff 
*skb)
        gpio_set_value(lp->slp_tr, 0);
 
        rc = wait_for_completion_interruptible(&lp->tx_complete);
-       if (rc < 0)
+       if (rc < 0) {
                at86rf230_state(dev, STATE_FORCE_TX_ON);
+               synchronize_irq(lp->spi->irq);
+               flush_work(&lp->irqwork);
+       }
 
 err_rx:
+       lp->is_tx = 0;
+
        rc2 = at86rf230_start(dev);
        if (!rc)
                rc = rc2;
 err:
        if (rc)
                pr_err("%s error: %d\n", __func__, rc);
-       lp->is_tx = 0;
 
        return rc;
 }
-- 
1.7.0.4


------------------------------------------------------------------------------
Simplify data backup and recovery for your virtual environment with vRanger.
Installation's a snap, and flexible recovery options mean your data is safe,
secure and there when you need it. Data protection magic?
Nope - It's vRanger. Get your free trial download today.
http://p.sf.net/sfu/quest-sfdev2dev
_______________________________________________
Linux-zigbee-devel mailing list
Linux-zigbee-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-zigbee-devel

Reply via email to