Re: [PATCH RFC] regmap: kunit: add tests for values wider than val_bits

From: Mark Brown

Date: Wed Nov 18 2026 - 06:30:37 EST


On Wed, Nov 18, 2026 at 11:04:56AM +0200, Andy Shevchenko wrote:
> On Tue, Nov 17, 2026 at 07:55:14AM +0000, Raffaele Tranfaglia via B4 Relay wrote:

> > +static void raw_write_wider_than_val_bits(struct kunit *test)
> > +{
> > + struct regmap *map;
> > + struct regmap_config config;
> > + struct regmap_ram_data *data;
> > + u16 *hw_buf;
> > + unsigned int rval;

> Reversed xmas tree order?

I simply do not care about this.

> > +
> > + /* The "hardware" should only have seen the low val_bits bits */
> > + if (config.val_format_endian == REGMAP_ENDIAN_BIG)
> > + KUNIT_EXPECT_EQ(test, 0xff0f,
> > + be16_to_cpu((__force __be16)hw_buf[0]));

> Do we really need those explicit castings? I think they are already inside
> the byteorder macros. Also we have be16_to_cpup() and le16_to_cpup() which
> might help.

If we do need the casts that probably indicates a problem.

Attachment: signature.asc
Description: PGP signature