[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240520152637.065bb8a8@kernel.org>
Date: Mon, 20 May 2024 15:26:37 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: Yury Norov <yury.norov@...il.com>
Cc: Michal Schmidt <mschmidt@...hat.com>, Rasmus Villemoes
<linux@...musvillemoes.dk>, linux-kernel@...r.kernel.org, Alex Elder
<elder@...aro.org>, "David S. Miller" <davem@...emloft.net>
Subject: Re: [PATCH] bitfield.h: add FIELD_MAX_CONST
On Mon, 20 May 2024 12:29:54 -0700 Yury Norov wrote:
> > A simplified example of what I actually want to use in a driver:
> > #define DATA_SIZE_M GENMASK(3, 0)
> > #define MAX_DATA_SIZE FIELD_MAX_CONST(DATA_SIZE_M)
> > static void f(void) {
> > char buf[MAX_DATA_SIZE];
You need a "+ 1" somewhere here, right?
> > }
> >
> > In the implementation, reuse the existing compile-time checks from
> > FIELD_PREP_CONST.
> >
> > Signed-off-by: Michal Schmidt <mschmidt@...hat.com>
>
> Hi Michal,
>
> So... FIELD_MAX() already requires the _mask to be a const value.
> Now you add a FIELD_MAX_CONST(), which makes it more confusing.
+1, I think this is doing too much in general.
Powered by blists - more mailing lists