summaryrefslogtreecommitdiff
path: root/drivers/staging/pi433
diff options
context:
space:
mode:
authorSidong Yang <realwakka@gmail.com>2019-03-24 17:54:41 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-03-25 23:49:11 +0300
commite5adddf5ae97811abe917b267a0d11daec5ccc16 (patch)
treede81d980e7c9bbe8d5014e2fba973d1d2b839054 /drivers/staging/pi433
parent344201e0f866853e739cf1eb073ca4c8a5823b24 (diff)
downloadlinux-e5adddf5ae97811abe917b267a0d11daec5ccc16.tar.xz
staging: pi433: remove unnecessary calling rf69_set_mode()
Remove unnecessary rf69_set_mode() function call when rx is waiting for a telegram. There is waste to call rf69_set_mode() twice for becoming standby mode. Signed-off-by: Sidong Yang <realwakka@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/pi433')
-rw-r--r--drivers/staging/pi433/pi433_if.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/drivers/staging/pi433/pi433_if.c b/drivers/staging/pi433/pi433_if.c
index 53928af696a6..e822f87fc533 100644
--- a/drivers/staging/pi433/pi433_if.c
+++ b/drivers/staging/pi433/pi433_if.c
@@ -650,21 +650,19 @@ pi433_tx_thread(void *data)
disable_irq(device->irq_num[DIO0]);
device->tx_active = true;
+ /* clear fifo, set fifo threshold, set payload length */
+ retval = rf69_set_mode(spi, standby); /* this clears the fifo */
+ if (retval < 0)
+ return retval;
+
if (device->rx_active && !rx_interrupted) {
/*
* rx is currently waiting for a telegram;
* we need to set the radio module to standby
*/
- retval = rf69_set_mode(device->spi, standby);
- if (retval < 0)
- return retval;
rx_interrupted = true;
}
- /* clear fifo, set fifo threshold, set payload length */
- retval = rf69_set_mode(spi, standby); /* this clears the fifo */
- if (retval < 0)
- return retval;
retval = rf69_set_fifo_threshold(spi, FIFO_THRESHOLD);
if (retval < 0)
return retval;