Commit e5adddf5 authored by Sidong Yang's avatar Sidong Yang Committed by Greg Kroah-Hartman
Browse files

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: default avatarSidong Yang <realwakka@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 344201e0
Loading
Loading
Loading
Loading
+5 −7
Original line number Diff line number Diff line
@@ -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;