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

Adrian Barnaś posted 2 patches 4 weeks, 1 day ago
.../pci/hive_isp_css_common/host/vmem.c       | 19 ++++++++++++-------
1 file changed, 12 insertions(+), 7 deletions(-)
[RFC PATCH v2 0/2] staging: media: atomisp: Refactor bit logic helpers in vmem.c
Posted by Adrian Barnaś 4 weeks, 1 day ago
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@google.com/ 

Adrian Barnaś (2):
  staging: media: atomisp: Change name to better follow its behavior
  staging: media: atomisp: Simplify logic in vmem.c

 .../pci/hive_isp_css_common/host/vmem.c       | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

-- 
2.51.0.355.g5224444f11-goog
Re: [RFC PATCH v2 0/2] staging: media: atomisp: Refactor bit logic helpers in vmem.c
Posted by Andy Shevchenko 4 weeks, 1 day ago
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@google.com/ 

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