Re: [PATCH 07/12] iio: pressure: rohm-bm1390: Fix AVE_NUM initialization

From: Matti Vaittinen

Date: Wed Sep 16 2026 - 01:26:37 EST


On 17/08/2026 04:15, Jonathan Cameron wrote:
On Tue, 11 Aug 2026 13:08:14 +0300
Andy Shevchenko <andriy.shevchenko@xxxxxxxxx> wrote:

On Tue, Aug 11, 2026 at 12:05:47PM +0300, Matti Vaittinen wrote:
On 10/08/2026 23:06, Andy Shevchenko wrote:
On Mon, Aug 10, 2026 at 10:53:07AM +0300, Matti Vaittinen wrote:

...

Use FIELD_PREP() to shift the intended AVE_NUM value to correct field.

Can it be FIELD_PREP_CONST()?

Can you please elaborate why it should in this case?

I'm not sure why it's not obvious, but the parameters are constants, why would
we need an additional check or even checks?

Hmm. I went and had a look as this macro turns up a fair bit.
I'm fairly sure in the case of a pair of compile time constants
FIELD_PREP() both performs additional checks at compile time and
probably collapses to a constant.
The docs for FIELD_PREP_CONST() observe it is for when
you need it to be a constant rather than when it might be
(even if you know it is)

So I think it's not necessarily appropriate here.

Thanks for digging deeper into this. :) Sounds like you confirm what I understood from the docs.

Yours,
-- Matti

--
Matti Vaittinen
Linux kernel developer at ROHM Semiconductors
Oulu Finland

~~ When things go utterly wrong vim users can always type :help! ~~