mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-27 14:14:24 +08:00
staging: pi433: goto abort when setting failed in tx_thread
tx_thread in pi433 works for transmitting. it reads tx_cfg and data stored in kfifo put in pi433_write() and transmits. If it exits, pi433_write() just store its data and no one transmits data. So, tx_thread should not exit even when it failed for setting registers. It seems that it's okay to go to abort and continue to loop and wait for writing. Signed-off-by: Sidong Yang <realwakka@gmail.com> Link: https://lore.kernel.org/r/20210923073115.7933-1-realwakka@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
152d9d5cde
commit
f3696bdfb6
@ -649,7 +649,7 @@ pi433_tx_thread(void *data)
|
|||||||
/* clear fifo, set fifo threshold, set payload length */
|
/* clear fifo, set fifo threshold, set payload length */
|
||||||
retval = rf69_set_mode(spi, standby); /* this clears the fifo */
|
retval = rf69_set_mode(spi, standby); /* this clears the fifo */
|
||||||
if (retval < 0)
|
if (retval < 0)
|
||||||
return retval;
|
goto abort;
|
||||||
|
|
||||||
if (device->rx_active && !rx_interrupted) {
|
if (device->rx_active && !rx_interrupted) {
|
||||||
/*
|
/*
|
||||||
@ -661,33 +661,33 @@ pi433_tx_thread(void *data)
|
|||||||
|
|
||||||
retval = rf69_set_fifo_threshold(spi, FIFO_THRESHOLD);
|
retval = rf69_set_fifo_threshold(spi, FIFO_THRESHOLD);
|
||||||
if (retval < 0)
|
if (retval < 0)
|
||||||
return retval;
|
goto abort;
|
||||||
if (tx_cfg.enable_length_byte == OPTION_ON) {
|
if (tx_cfg.enable_length_byte == OPTION_ON) {
|
||||||
retval = rf69_set_payload_length(spi, size * tx_cfg.repetitions);
|
retval = rf69_set_payload_length(spi, size * tx_cfg.repetitions);
|
||||||
if (retval < 0)
|
if (retval < 0)
|
||||||
return retval;
|
goto abort;
|
||||||
} else {
|
} else {
|
||||||
retval = rf69_set_payload_length(spi, 0);
|
retval = rf69_set_payload_length(spi, 0);
|
||||||
if (retval < 0)
|
if (retval < 0)
|
||||||
return retval;
|
goto abort;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* configure the rf chip */
|
/* configure the rf chip */
|
||||||
retval = rf69_set_tx_cfg(device, &tx_cfg);
|
retval = rf69_set_tx_cfg(device, &tx_cfg);
|
||||||
if (retval < 0)
|
if (retval < 0)
|
||||||
return retval;
|
goto abort;
|
||||||
|
|
||||||
/* enable fifo level interrupt */
|
/* enable fifo level interrupt */
|
||||||
retval = rf69_set_dio_mapping(spi, DIO1, DIO_FIFO_LEVEL);
|
retval = rf69_set_dio_mapping(spi, DIO1, DIO_FIFO_LEVEL);
|
||||||
if (retval < 0)
|
if (retval < 0)
|
||||||
return retval;
|
goto abort;
|
||||||
device->irq_state[DIO1] = DIO_FIFO_LEVEL;
|
device->irq_state[DIO1] = DIO_FIFO_LEVEL;
|
||||||
irq_set_irq_type(device->irq_num[DIO1], IRQ_TYPE_EDGE_FALLING);
|
irq_set_irq_type(device->irq_num[DIO1], IRQ_TYPE_EDGE_FALLING);
|
||||||
|
|
||||||
/* enable packet sent interrupt */
|
/* enable packet sent interrupt */
|
||||||
retval = rf69_set_dio_mapping(spi, DIO0, DIO_PACKET_SENT);
|
retval = rf69_set_dio_mapping(spi, DIO0, DIO_PACKET_SENT);
|
||||||
if (retval < 0)
|
if (retval < 0)
|
||||||
return retval;
|
goto abort;
|
||||||
device->irq_state[DIO0] = DIO_PACKET_SENT;
|
device->irq_state[DIO0] = DIO_PACKET_SENT;
|
||||||
irq_set_irq_type(device->irq_num[DIO0], IRQ_TYPE_EDGE_RISING);
|
irq_set_irq_type(device->irq_num[DIO0], IRQ_TYPE_EDGE_RISING);
|
||||||
enable_irq(device->irq_num[DIO0]); /* was disabled by rx active check */
|
enable_irq(device->irq_num[DIO0]); /* was disabled by rx active check */
|
||||||
@ -695,7 +695,7 @@ pi433_tx_thread(void *data)
|
|||||||
/* enable transmission */
|
/* enable transmission */
|
||||||
retval = rf69_set_mode(spi, transmit);
|
retval = rf69_set_mode(spi, transmit);
|
||||||
if (retval < 0)
|
if (retval < 0)
|
||||||
return retval;
|
goto abort;
|
||||||
|
|
||||||
/* transfer this msg (and repetitions) to chip fifo */
|
/* transfer this msg (and repetitions) to chip fifo */
|
||||||
device->free_in_fifo = FIFO_SIZE;
|
device->free_in_fifo = FIFO_SIZE;
|
||||||
@ -742,7 +742,7 @@ pi433_tx_thread(void *data)
|
|||||||
dev_dbg(device->dev, "thread: Packet sent. Set mode to stby.");
|
dev_dbg(device->dev, "thread: Packet sent. Set mode to stby.");
|
||||||
retval = rf69_set_mode(spi, standby);
|
retval = rf69_set_mode(spi, standby);
|
||||||
if (retval < 0)
|
if (retval < 0)
|
||||||
return retval;
|
goto abort;
|
||||||
|
|
||||||
/* everything sent? */
|
/* everything sent? */
|
||||||
if (kfifo_is_empty(&device->tx_fifo)) {
|
if (kfifo_is_empty(&device->tx_fifo)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user