[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aLa78SILWdVG9AJj@smile.fi.intel.com>
Date: Tue, 2 Sep 2025 12:42:09 +0300
From: Andy Shevchenko <andriy.shevchenko@...el.com>
To: Adrian Barnaś <abarnas@...gle.com>
Cc: Hans de Goede <hansg@...nel.org>,
Mauro Carvalho Chehab <mchehab@...nel.org>,
Sakari Ailus <sakari.ailus@...ux.intel.com>,
Andy Shevchenko <andy@...nel.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Dan Carpenter <dan.carpenter@...aro.org>,
linux-media@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-staging@...ts.linux.dev
Subject: Re: [RFC] staging: media: atomisp: Simplyfy masking bit logic
On Tue, Sep 02, 2025 at 07:38:40AM +0000, Adrian Barnaś wrote:
> Simplified masking logic in pci/hive_isp_css_common/host/vmem.c.
...
> ---
>
> I have tested this change on whole range of *valid* inputs, and it gives
> the same results as before, but this function seems to be little
> counter-intuitive as far as start is a (bit index) but end is
> (bit index + 1).
We can't change it without changing the callers at the same time.
So, better to change just helpers and later on, if working, change
the semantics of the parameter.
> ---
...
> subword(hive_uedge w, unsigned int start, unsigned int end)
> {
> - return (w & (((1ULL << (end - 1)) - 1) << 1 | 1)) >> start;
> + return (w & __GENMASK_ULL(end-1, 0)) >> start;
Why __ variant?
> }
...
> inv_subword(hive_uedge w, unsigned int start, unsigned int end)
> {
> - return w & (~(((1ULL << (end - 1)) - 1) << 1 | 1) | ((1ULL << start) - 1));
> + return w & (~__GENMASK_ULL(end-1, start));
> }
Ditto.
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists