Re: [PATCH 28/57] media: Add ovxxxx_16bit_addr_reg_helpers.h

Andy Shevchenko
2023-02-08T11:28:20Z

On Wed, Feb 8, 2023 at 11:52 AM Laurent Pinchart
<laurent.pinchart@ideasonboard.com> wrote:
> On Mon, Jan 23, 2023 at 01:51:36PM +0100, Hans de Goede wrote:

...

> > Add a new ovxxxx_16bit_addr_reg_helpers.h header file with static inline
> > versions of these register access helpers, so that this code duplication
> > can be removed.
>
> Any reason to hand-roll those instead of using regmap ? Also, may I
> suggest to have a look at drivers/media/i2c/imx290.c

While this is a bit error prone example, a patch is on its way, ...

> for an example of
> how registers of different sizes can be handled in a less error-prone
> way, using single read/write functions that adapt to the size
> automatically ?

...with regmap fields I believe you can avoid even that and use proper
regmap accessors directly.

--
With Best Regards,
Andy Shevchenko