mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-23 13:00:33 +07:00
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>
This commit is contained in:
parent
a4f93fc718
commit
81a6e1cc31
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user