Re: [RFC PATCH v2 0/2] staging: media: atomisp: Refactor bit logic helpers in vmem.c

From: Andy Shevchenko
Date: Wed Sep 03 2025 - 07:08:06 EST


On Wed, Sep 03, 2025 at 09:27:52AM +0000, Adrian Barnaś wrote:
> Refactor proposition for bit operation in vmem.c.
> * Previous name for function "inv_subword()" for me is not telling what
> function acctualy does - it clears bit specified by subword, so renamed
> to clear_subword()
> * Added a helper to create a proper bitmask for a subword, without using
> GENMASK(end-1, start) which was claimed to be unsafe
> * Simplified subword() and clear_subword() to be more readable.
>
> Continuation of https://lore.kernel.org/linux-staging/20250902073841.2338568-1-abarnas@xxxxxxxxxx/

Thanks for the effort, but I think it's just a tip of the iceberg.
What we really need is to completely rewrite hive_sim_wide_unpack()
and hive_sim_wide_pack(). If we want to preserve arbitrary bit numbers
we ought to use bitmap API rather than that custom approach.

--
With Best Regards,
Andy Shevchenko