From: Paulo Miguel Almeida <paulo.miguel.almeida.rodenas@gmail.com>
To: gregkh@linuxfoundation.org,
paulo.miguel.almeida.rodenas@gmail.com, realwakka@gmail.com
Cc: linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: [PATCH v2 2/3] staging: pi433: change order in which driver config the rf69 chip
Date: Mon, 17 Jan 2022 19:01:38 +1300 [thread overview]
Message-ID: <20220117060138.GA11140@mail.google.com> (raw)
In-Reply-To: <20220117055849.GA10644@mail.google.com>
There is an explicit dependency between modulation and bit rate
configurations. To ensure proper validation of input value for the
set_bit_rate routine, we must ensure that modulation has been set
before.
This patch ensures that set_modulation is always called before
set_bit_rate for both RX and TX routines
Signed-off-by: Paulo Miguel Almeida <paulo.miguel.almeida.rodenas@gmail.com>
---
drivers/staging/pi433/pi433_if.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/staging/pi433/pi433_if.c b/drivers/staging/pi433/pi433_if.c
index f9f86e2c44a9..17ff51f6a9da 100644
--- a/drivers/staging/pi433/pi433_if.c
+++ b/drivers/staging/pi433/pi433_if.c
@@ -167,10 +167,10 @@ rf69_set_rx_cfg(struct pi433_device *dev, struct pi433_rx_cfg *rx_cfg)
ret = rf69_set_frequency(dev->spi, rx_cfg->frequency);
if (ret < 0)
return ret;
- ret = rf69_set_bit_rate(dev->spi, rx_cfg->bit_rate);
+ ret = rf69_set_modulation(dev->spi, rx_cfg->modulation);
if (ret < 0)
return ret;
- ret = rf69_set_modulation(dev->spi, rx_cfg->modulation);
+ ret = rf69_set_bit_rate(dev->spi, rx_cfg->bit_rate);
if (ret < 0)
return ret;
ret = rf69_set_antenna_impedance(dev->spi, rx_cfg->antenna_impedance);
@@ -290,10 +290,10 @@ rf69_set_tx_cfg(struct pi433_device *dev, struct pi433_tx_cfg *tx_cfg)
ret = rf69_set_frequency(dev->spi, tx_cfg->frequency);
if (ret < 0)
return ret;
- ret = rf69_set_bit_rate(dev->spi, tx_cfg->bit_rate);
+ ret = rf69_set_modulation(dev->spi, tx_cfg->modulation);
if (ret < 0)
return ret;
- ret = rf69_set_modulation(dev->spi, tx_cfg->modulation);
+ ret = rf69_set_bit_rate(dev->spi, tx_cfg->bit_rate);
if (ret < 0)
return ret;
ret = rf69_set_deviation(dev->spi, tx_cfg->dev_frequency);
--
2.25.4
next prev parent reply other threads:[~2022-01-17 6:01 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-16 0:17 [PATCH 0/3] staging: pi433: validate min/max bit rate settings Paulo Miguel Almeida
2022-01-16 0:21 ` [PATCH 1/3] staging: pi433: fix validation for min bit rate supported by the device Paulo Miguel Almeida
2022-01-16 0:22 ` [PATCH 2/3] staging: pi433: change order in which driver config the rf69 chip Paulo Miguel Almeida
2022-01-16 0:23 ` [PATCH 3/3] staging: pi433: validate max bit_rate based on modulation used Paulo Miguel Almeida
2022-01-16 14:06 ` kernel test robot
2022-01-16 14:06 ` kernel test robot
2022-01-17 5:58 ` [PATCH v2 0/3] staging: pi433: validate min/max bit rate settings Paulo Miguel Almeida
2022-01-17 6:00 ` [PATCH v2 1/3] staging: pi433: fix validation for min bit rate supported by the device Paulo Miguel Almeida
2022-01-17 6:01 ` Paulo Miguel Almeida [this message]
2022-01-17 6:02 ` [PATCH v2 3/3] staging: pi433: validate max bit_rate based on modulation used Paulo Miguel Almeida
2022-01-18 13:59 ` Dan Carpenter
2022-01-18 19:34 ` Paulo Miguel Almeida
2022-01-18 23:03 ` [PATCH v3 0/3] staging: pi433: validate min/max bit rate settings Paulo Miguel Almeida
2022-01-18 23:04 ` [PATCH v3 1/3] staging: pi433: fix validation for min bit rate supported by the device Paulo Miguel Almeida
2022-01-18 23:05 ` [PATCH v3 2/3] staging: pi433: change order in which driver config the rf69 chip Paulo Miguel Almeida
2022-01-18 23:05 ` [PATCH v3 3/3] staging: pi433: validate max bit_rate based on modulation used Paulo Miguel Almeida
2022-01-19 6:04 ` [PATCH v3 0/3] staging: pi433: validate min/max bit rate settings Dan Carpenter
2022-01-23 7:43 ` Paulo Miguel Almeida
2022-01-24 8:53 ` Dan Carpenter
2022-01-19 5:34 ` [PATCH v2 3/3] staging: pi433: validate max bit_rate based on modulation used Dan Carpenter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220117060138.GA11140@mail.google.com \
--to=paulo.miguel.almeida.rodenas@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
--cc=realwakka@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.