Commit 3ff7092b authored by Alexander Aring's avatar Alexander Aring Committed by Marcel Holtmann

at86rf230: remove unnecessary spinlock

This spinlock isn't necessary because if we are in TX_ON/TX_ARET_ON
state the transceiver can't be interrupted e.g. by receiving a frame
when a SHR was detected. In this time the transceiver doesn't leave
the TX_ON/TX_ARET_ON state until the tx complete irq change the state
into RX_AACK_ON again. This means a receiving interrupt in state
TX_ON/TX_ARET_ON can't happen and is_tx is protected by transceiver.
Signed-off-by: default avatarAlexander Aring <alex.aring@gmail.com>
Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
parent 8bf9538a
...@@ -25,7 +25,6 @@ ...@@ -25,7 +25,6 @@
#include <linux/irq.h> #include <linux/irq.h>
#include <linux/gpio.h> #include <linux/gpio.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/spinlock.h>
#include <linux/spi/spi.h> #include <linux/spi/spi.h>
#include <linux/spi/at86rf230.h> #include <linux/spi/at86rf230.h>
#include <linux/regmap.h> #include <linux/regmap.h>
...@@ -96,8 +95,6 @@ struct at86rf230_local { ...@@ -96,8 +95,6 @@ struct at86rf230_local {
unsigned long cal_timeout; unsigned long cal_timeout;
s8 max_frame_retries; s8 max_frame_retries;
bool is_tx; bool is_tx;
/* spinlock for is_tx protection */
spinlock_t lock;
u8 tx_retry; u8 tx_retry;
struct sk_buff *tx_skb; struct sk_buff *tx_skb;
struct at86rf230_state_change tx; struct at86rf230_state_change tx;
...@@ -878,10 +875,8 @@ at86rf230_rx_trac_check(void *context) ...@@ -878,10 +875,8 @@ at86rf230_rx_trac_check(void *context)
static void static void
at86rf230_irq_trx_end(struct at86rf230_local *lp) at86rf230_irq_trx_end(struct at86rf230_local *lp)
{ {
spin_lock(&lp->lock);
if (lp->is_tx) { if (lp->is_tx) {
lp->is_tx = 0; lp->is_tx = 0;
spin_unlock(&lp->lock);
if (lp->tx_aret) if (lp->tx_aret)
at86rf230_async_state_change(lp, &lp->irq, at86rf230_async_state_change(lp, &lp->irq,
...@@ -894,7 +889,6 @@ at86rf230_irq_trx_end(struct at86rf230_local *lp) ...@@ -894,7 +889,6 @@ at86rf230_irq_trx_end(struct at86rf230_local *lp)
at86rf230_tx_complete, at86rf230_tx_complete,
true); true);
} else { } else {
spin_unlock(&lp->lock);
at86rf230_async_read_reg(lp, RG_TRX_STATE, &lp->irq, at86rf230_async_read_reg(lp, RG_TRX_STATE, &lp->irq,
at86rf230_rx_trac_check, true); at86rf230_rx_trac_check, true);
} }
...@@ -964,9 +958,7 @@ at86rf230_write_frame(void *context) ...@@ -964,9 +958,7 @@ at86rf230_write_frame(void *context)
u8 *buf = ctx->buf; u8 *buf = ctx->buf;
int rc; int rc;
spin_lock(&lp->lock);
lp->is_tx = 1; lp->is_tx = 1;
spin_unlock(&lp->lock);
buf[0] = CMD_FB | CMD_WRITE; buf[0] = CMD_FB | CMD_WRITE;
buf[1] = skb->len + 2; buf[1] = skb->len + 2;
...@@ -1698,7 +1690,6 @@ static int at86rf230_probe(struct spi_device *spi) ...@@ -1698,7 +1690,6 @@ static int at86rf230_probe(struct spi_device *spi)
if (rc < 0) if (rc < 0)
goto free_dev; goto free_dev;
spin_lock_init(&lp->lock);
init_completion(&lp->state_complete); init_completion(&lp->state_complete);
spi_set_drvdata(spi, lp); spi_set_drvdata(spi, lp);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment