[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZcUwK9DAVMVzq1Mk@ashyti-mobl2.lan>
Date: Thu, 8 Feb 2024 20:48:59 +0100
From: Andi Shyti <andi.shyti@...ux.intel.com>
To: Lucas De Marchi <lucas.demarchi@...el.com>
Cc: Yury Norov <yury.norov@...il.com>, linux-kernel@...r.kernel.org,
dri-devel@...ts.freedesktop.org,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Jani Nikula <jani.nikula@...ux.intel.com>,
intel-xe@...ts.freedesktop.org, intel-gfx@...ts.freedesktop.org,
Jani Nikula <jani.nikula@...el.com>
Subject: Re: [PATCH v3 1/3] bits: introduce fixed-type genmasks
Hi Lucas and Yury,
On Wed, Feb 07, 2024 at 11:45:19PM -0800, Lucas De Marchi wrote:
> From: Yury Norov <yury.norov@...il.com>
>
> Generalize __GENMASK() to support different types, and implement
> fixed-types versions of GENMASK() based on it. The fixed-type version
> allows more strict checks to the min/max values accepted, which is
> useful for defining registers like implemented by i915 and xe drivers
> with their REG_GENMASK*() macros.
>
> The strict checks rely on shift-count-overflow compiler check to
> fail the build if a number outside of the range allowed is passed.
> Example:
>
> #define FOO_MASK GENMASK_U32(33, 4)
>
> will generate a warning like:
>
> ../include/linux/bits.h:41:31: error: left shift count >= width of type [-Werror=shift-count-overflow]
> 41 | (((t)~0ULL - ((t)(1) << (l)) + 1) & \
> | ^~
>
> Signed-off-by: Yury Norov <yury.norov@...il.com>
> Signed-off-by: Lucas De Marchi <lucas.demarchi@...el.com>
> Acked-by: Jani Nikula <jani.nikula@...el.com>
Lucas' SoB should be at the bottom here. In any case, nice patch:
Reviewed-by: Andi Shyti <andi.shyti@...ux.intel.com>
Thanks,
Andi
Powered by blists - more mailing lists