[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aLWS9QsvmzZW4Bak@smile.fi.intel.com>
Date: Mon, 1 Sep 2025 15:35:01 +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: [PATCH 1/2] staging: media: atomisp: Remove typedefs for basic
types in vmem.c
On Mon, Sep 01, 2025 at 09:10:49AM +0000, Adrian Barnaś wrote:
> Cleared typedefs hiding unsigned long long type, to align with
> kernel coding style.
...
> -static inline hive_uedge
> -subword(hive_uedge w, unsigned int start, unsigned int end)
> +static inline unsigned long long
> +subword(unsigned long long w, unsigned int start, unsigned int end)
> {
> return (w & (((1ULL << (end - 1)) - 1) << 1 | 1)) >> start;
> }
>
> /* inverse subword bits move like this: MSB[xxxx____xxxx]LSB -> MSB[xxxx0000xxxx]LSB */
> -static inline hive_uedge
> -inv_subword(hive_uedge w, unsigned int start, unsigned int end)
> +static inline unsigned long long
> +inv_subword(unsigned long long w, unsigned int start, unsigned int end)
> {
> return w & (~(((1ULL << (end - 1)) - 1) << 1 | 1) | ((1ULL << start) - 1));
> }
Also consider to simplify the above (in a separate change).
static inline unsigned long long
subword(unsigned long long w, unsigned int start, unsigned int end)
{
return (w & GENMASK_ULL(end, 0)) >> start;
}
static inline unsigned long long
inv_subword(unsigned long long w, unsigned int start, unsigned int end)
{
return w & (~GENMASK_ULL(end, 0) | GENMASK_ULL(start, 0));
}
...if I'm not mistaken, so double check all these.
At least in my case the end == 64 is not allowed while it seems the original
code allows it to be equal to the end == 63 case. Needs testing anyway...
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists