summaryrefslogtreecommitdiffstats
path: root/drivers/staging/pi433
diff options
context:
space:
mode:
authorSidong Yang <realwakka@gmail.com>2019-03-28 09:49:14 +0000
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-03-29 17:10:18 +0100
commit81a6e1cc312ea43b4a23e6f371dda1bd233ea750 (patch)
tree7d347a8839a11642895646320586bbb5cab20c08 /drivers/staging/pi433
parenta4f93fc7183f2799c8689a402adc5f355b926e02 (diff)
downloadblackbird-op-linux-81a6e1cc312ea43b4a23e6f371dda1bd233ea750.tar.gz
blackbird-op-linux-81a6e1cc312ea43b4a23e6f371dda1bd233ea750.zip
staging: pi433: Fix rf69_set_tx_cfg() logic
Moved code to configure sync to where check enable_sync option before. There is no need to check enable_sync twice. Configuring sync should be executed immediately after enabling sync. 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.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/drivers/staging/pi433/pi433_if.c b/drivers/staging/pi433/pi433_if.c
index e822f87fc533..ab90d6f80931 100644
--- a/drivers/staging/pi433/pi433_if.c
+++ b/drivers/staging/pi433/pi433_if.c
@@ -319,6 +319,12 @@ rf69_set_tx_cfg(struct pi433_device *dev, struct pi433_tx_cfg *tx_cfg)
}
if (tx_cfg->enable_sync == OPTION_ON) {
+ ret = rf69_set_sync_size(dev->spi, tx_cfg->sync_length);
+ if (ret < 0)
+ return ret;
+ ret = rf69_set_sync_values(dev->spi, tx_cfg->sync_pattern);
+ if (ret < 0)
+ return ret;
ret = rf69_enable_sync(dev->spi);
if (ret < 0)
return ret;
@@ -348,16 +354,6 @@ rf69_set_tx_cfg(struct pi433_device *dev, struct pi433_tx_cfg *tx_cfg)
return ret;
}
- /* configure sync, if enabled */
- if (tx_cfg->enable_sync == OPTION_ON) {
- ret = rf69_set_sync_size(dev->spi, tx_cfg->sync_length);
- if (ret < 0)
- return ret;
- ret = rf69_set_sync_values(dev->spi, tx_cfg->sync_pattern);
- if (ret < 0)
- return ret;
- }
-
return 0;
}
OpenPOWER on IntegriCloud