From: Jonathan Cameron <jic23@kernel.org>
To: Matti Vaittinen <matti.vaittinen@linux.dev>
Cc: "Matti Vaittinen" <mazziesaccount@gmail.com>,
"Matti Vaittinen" <matti.vaittinen@fi.rohmeurope.com>,
"David Lechner" <dlechner@baylibre.com>,
"Nuno Sá" <nuno.sa@analog.com>,
"Andy Shevchenko" <andy@kernel.org>,
"Javier Carrasco" <javier.carrasco.cruz@gmail.com>,
"Mehdi Djait" <mehdi.djait.k@gmail.com>,
linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
"Kalle Niemi" <kaleposti@gmail.com>,
"Topi Sonkajärvi" <sonkajarvi@hotmail.com>
Subject: Re: [PATCH 07/12] iio: pressure: rohm-bm1390: Fix AVE_NUM initialization
Date: Mon, 17 Aug 2026 02:12:52 +0100 [thread overview]
Message-ID: <20260817021252.5ef32a57@jic23-huawei> (raw)
In-Reply-To: <7784e12793187a75dc10b0e84471f0cefe4d28b9.1786347811.git.mazziesaccount@gmail.com>
On Mon, 10 Aug 2026 10:53:07 +0300
Matti Vaittinen <matti.vaittinen@linux.dev> wrote:
> From: Matti Vaittinen <mazziesaccount@gmail.com>
>
> The BM1390 tries to initialize the AVE_NUM to 110b at the start-up. The
> field location is not taken into account, and value is written unsifted.
> This causes the AVE_NUM to be initialized to zero.
>
> Use FIELD_PREP() to shift the intended AVE_NUM value to correct field.
>
> Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
> Fixes: 81ca5979b6ed ("iio: pressure: Support ROHM BU1390")
> ---
> drivers/iio/pressure/rohm-bm1390.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/iio/pressure/rohm-bm1390.c b/drivers/iio/pressure/rohm-bm1390.c
> index d00d7ed54cb1..29454570f257 100644
> --- a/drivers/iio/pressure/rohm-bm1390.c
> +++ b/drivers/iio/pressure/rohm-bm1390.c
> @@ -479,6 +479,7 @@ static const struct iio_info bm1390_info = {
>
> static int bm1390_chip_init(struct bm1390_data *data)
> {
> + u8 regval;
> int ret;
>
> ret = regmap_write_bits(data->regmap, BM1390_REG_POWER,
> @@ -512,8 +513,9 @@ static int bm1390_chip_init(struct bm1390_data *data)
> * Default to use IIR filter in "middle" mode. Also the AVE_NUM must
> * be fixed when IIR is in use.
> */
> + regval = FIELD_PREP(BM1390_MASK_AVE_NUM, BM1390_IIR_AVE_NUM);
> ret = regmap_update_bits(data->regmap, BM1390_REG_MODE_CTRL,
> - BM1390_MASK_AVE_NUM, BM1390_IIR_AVE_NUM);
> + BM1390_MASK_AVE_NUM,
FIELD_PREP(BM1390_MASK_AVE_NUM, BM1390_IIR_AVE_NUM));
If respining I would drop the local variable and just go a bit long on the line.
I like the mask to be clearly visible in both parameters and a local variable
prevents that. Fine if the line is really long, but it's only about 83 chars here.
Jonathan
> if (ret)
> return ret;
>
next prev parent reply other threads:[~2026-08-17 1:12 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-10 7:49 [PATCH 00/12] ROHM IIO fixes Matti Vaittinen
2026-08-10 7:49 ` [PATCH 01/12] iio: adc: rohm-bd79124: Fix rising alarm Matti Vaittinen
2026-08-17 1:17 ` Jonathan Cameron
2026-08-10 7:50 ` [PATCH 02/12] iio: adc: rohm-bd79124: Fix channel initialization Matti Vaittinen
2026-08-17 1:23 ` Jonathan Cameron
2026-08-10 7:50 ` [PATCH 03/12] iio: adc: rohm-bd79124: Fix GPIO mask check Matti Vaittinen
2026-08-17 1:23 ` Jonathan Cameron
2026-08-10 7:51 ` [PATCH 04/12] iio: adc: rohm-bd79124: Catch regmap errors at measurement start/stop Matti Vaittinen
2026-08-17 1:27 ` Jonathan Cameron
2026-08-10 7:51 ` [PATCH 05/12] iio: dac: rohm-bd79703: Do not allow writing SCALE Matti Vaittinen
2026-08-17 1:32 ` Jonathan Cameron
2026-08-10 7:52 ` [PATCH 06/12] iio: pressure: rohm-bm1390: Return error when read fails Matti Vaittinen
2026-08-17 1:34 ` Jonathan Cameron
2026-08-10 7:53 ` [PATCH 07/12] iio: pressure: rohm-bm1390: Fix AVE_NUM initialization Matti Vaittinen
2026-08-10 20:06 ` Andy Shevchenko
2026-08-11 9:05 ` Matti Vaittinen
2026-08-11 10:08 ` Andy Shevchenko
2026-08-17 1:19 ` Jonathan Cameron
2026-08-17 1:12 ` Jonathan Cameron [this message]
2026-08-10 7:53 ` [PATCH 08/12] iio: light: rohm-bu27034: Fix error return Matti Vaittinen
2026-08-17 1:35 ` Jonathan Cameron
2026-08-10 7:54 ` [PATCH 09/12] iio: light: rohm-bu27034: Fix infinite delay on error Matti Vaittinen
2026-08-10 20:09 ` Andy Shevchenko
2026-08-11 9:07 ` Matti Vaittinen
2026-08-10 7:54 ` [PATCH 10/12] iio: accel: kionix-kx022a: Fix array boundary check Matti Vaittinen
2026-08-12 11:43 ` Mehdi Djait
2026-08-17 1:37 ` Jonathan Cameron
2026-08-10 7:55 ` [PATCH 11/12] iio: accel: kionix-kx022a: Prevent memory leak and fix state Matti Vaittinen
2026-08-12 11:47 ` [PATCH 11/12] iio: accel: kionix-kx022a: Prevent memory leak and fix statey Mehdi Djait
2026-08-14 7:39 ` Matti Vaittinen
2026-08-17 1:49 ` Jonathan Cameron
2026-08-17 1:45 ` [PATCH 11/12] iio: accel: kionix-kx022a: Prevent memory leak and fix state Jonathan Cameron
2026-08-10 7:55 ` [PATCH 12/12] iio: accel: kionix-kx022a: Fix IPOL macro name Matti Vaittinen
2026-08-12 11:53 ` Mehdi Djait
2026-08-14 7:43 ` Matti Vaittinen
2026-08-17 1:54 ` Jonathan Cameron
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=20260817021252.5ef32a57@jic23-huawei \
--to=jic23@kernel.org \
--cc=andy@kernel.org \
--cc=dlechner@baylibre.com \
--cc=javier.carrasco.cruz@gmail.com \
--cc=kaleposti@gmail.com \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=matti.vaittinen@fi.rohmeurope.com \
--cc=matti.vaittinen@linux.dev \
--cc=mazziesaccount@gmail.com \
--cc=mehdi.djait.k@gmail.com \
--cc=nuno.sa@analog.com \
--cc=sonkajarvi@hotmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox