[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAATBrPFnSnxwzBQTOdbt0h=epXW7G5Rj8Sr_erKKzUzCH6xC5g@mail.gmail.com>
Date: Mon, 1 Sep 2025 15:27:19 +0200
From: Adrian Barnaś <abarnas@...gle.com>
To: Andy Shevchenko <andriy.shevchenko@...el.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 1, 2025 at 2:35 PM Andy Shevchenko
<andriy.shevchenko@...el.com> wrote:
>
> 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...
Those functions works odd:
when (end = 8, start = 0) it affects bits 0...7
This should make the same results, will check twice if i not missed
anything and post v2:
static inline unsigned long long _subword(unsigned long long w,
unsigned int start,
unsigned int end)
{
return (w & GENMASK_ULL(end-1, 0)) >> start;
}
static inline unsigned long long _inv_subword(unsigned long long w,
unsigned int start,
unsigned int end)
{
return w & (~GENMASK_ULL(end-1, start));
}
Thank you for a review
Adrian Barnaś
Powered by blists - more mailing lists