public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Yury Norov <yury.norov@gmail.com>
To: Vincent Mailhol <mailhol.vincent@wanadoo.fr>
Cc: Jani Nikula <jani.nikula@linux.intel.com>,
	Lucas De Marchi <lucas.demarchi@intel.com>,
	Rasmus Villemoes <linux@rasmusvillemoes.dk>,
	Joonas Lahtinen <joonas.lahtinen@linux.intel.com>,
	Rodrigo Vivi <rodrigo.vivi@intel.com>,
	Tvrtko Ursulin <tursulin@ursulin.net>,
	David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>,
	Andrew Morton <akpm@linux-foundation.org>,
	linux-kernel@vger.kernel.org, intel-gfx@lists.freedesktop.org,
	dri-devel@lists.freedesktop.org,
	Andi Shyti <andi.shyti@linux.intel.com>,
	David Laight <David.Laight@aculab.com>,
	Dmitry Baryshkov <dmitry.baryshkov@linaro.org>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Subject: Re: [PATCH v6 4/7] drm/i915: Convert REG_GENMASK*() to fixed-width GENMASK_U*()
Date: Wed, 19 Mar 2025 09:25:56 -0400	[thread overview]
Message-ID: <Z9rF5JFcEW2DOtcr@thinkpad> (raw)
In-Reply-To: <f6885fdb-4361-428c-b6dd-54cd2ac7904d@wanadoo.fr>

On Wed, Mar 19, 2025 at 01:37:32PM +0900, Vincent Mailhol wrote:
> On 19/03/2025 at 07:32, Jani Nikula wrote:
> > On Tue, 18 Mar 2025, Yury Norov <yury.norov@gmail.com> wrote:
> >> On Sat, Mar 08, 2025 at 01:48:51AM +0900, Vincent Mailhol via B4 Relay wrote:
> >>> From: Lucas De Marchi <lucas.demarchi@intel.com>
> >>>
> >>> Now that include/linux/bits.h implements fixed-width GENMASK_U*(), use
> >>> them to implement the i915/xe specific macros. Converting each driver
> >>> to use the generic macros are left for later, when/if other
> >>> driver-specific macros are also generalized.
> >>>
> >>> Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
> >>> Acked-by: Jani Nikula <jani.nikula@intel.com>
> >>> Signed-off-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr>
> >>> ---
> >>> Changelog:
> >>>
> >>>   v5 -> v6:
> >>>
> >>>     - No changes.
> >>>
> >>>   v4 -> v5:
> >>>
> >>>     - Add braket to macro names in patch description,
> >>>       e.g. 'REG_GENMASK*' -> 'REG_GENMASK*()'
> >>>
> >>>   v3 -> v4:
> >>>
> >>>     - Remove the prefixes in macro parameters,
> >>>       e.g. 'REG_GENMASK(__high, __low)' -> 'REG_GENMASK(high, low)'
> >>> ---
> >>>  drivers/gpu/drm/i915/i915_reg_defs.h | 108 ++++-------------------------------
> >>>  1 file changed, 11 insertions(+), 97 deletions(-)
> >>>
> >>> diff --git a/drivers/gpu/drm/i915/i915_reg_defs.h b/drivers/gpu/drm/i915/i915_reg_defs.h
> >>> index e251bcc0c89f5710125bc70f07851b2cb978c89c..39e5ed9511174b8757b9201bff735fa362651b34 100644
> >>> --- a/drivers/gpu/drm/i915/i915_reg_defs.h
> >>> +++ b/drivers/gpu/drm/i915/i915_reg_defs.h
> >>> @@ -9,76 +9,19 @@
> >>>  #include <linux/bitfield.h>
> >>>  #include <linux/bits.h>
> >>>  
> >>> -/**
> >>> - * REG_BIT() - Prepare a u32 bit value
> >>> - * @__n: 0-based bit number
> >>> - *
> >>> - * Local wrapper for BIT() to force u32, with compile time checks.
> >>> - *
> >>> - * @return: Value with bit @__n set.
> >>> +/*
> >>> + * Wrappers over the generic BIT_* and GENMASK_* implementations,
> >>> + * for compatibility reasons with previous implementation
> >>>   */
> >>> -#define REG_BIT(__n)							\
> >>> -	((u32)(BIT(__n) +						\
> >>> -	       BUILD_BUG_ON_ZERO(__is_constexpr(__n) &&		\
> >>> -				 ((__n) < 0 || (__n) > 31))))
> >>> +#define REG_GENMASK(high, low)		GENMASK_U32(high, low)
> >>> +#define REG_GENMASK64(high, low)	GENMASK_U64(high, low)
> >>> +#define REG_GENMASK16(high, low)	GENMASK_U16(high, low)
> >>> +#define REG_GENMASK8(high, low)		GENMASK_U8(high, low)
> >>
> >> Nit. Maybe just
> >>
> >>  #define REG_GENMASK		GENMASK_U32
> > 
> > Please just keep it as it is for clarity.
> 
> I also prefer when the argument is clearly displayed. It shows at first
> glance that this is a function-like macro and reminds of the correct
> order of the argument without having to look at the definitions in
> bits.h. It also allows for people to grep "#define REG_GENMASK(" in
> order to find the macro definition.
> 
> To be honest, I don't have a strong opinion either, but because Jani
> also prefers it this way, I will keep as-is.

Please go with the original version. It was just a minor nitpick.

  reply	other threads:[~2025-03-19 13:25 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-07 16:48 [PATCH v6 0/7] bits: Fixed-type GENMASK_U*() and BIT_U*() Vincent Mailhol via B4 Relay
2025-03-07 16:48 ` [PATCH v6 1/7] bits: split the definition of the asm and non-asm GENMASK() Vincent Mailhol via B4 Relay
2025-03-07 17:42   ` Andy Shevchenko
2025-03-08  9:10     ` Vincent Mailhol
2025-03-18 16:06       ` Yury Norov
2025-03-18 16:14         ` Vincent Mailhol
2025-03-07 16:48 ` [PATCH v6 2/7] bits: introduce fixed-type genmasks Vincent Mailhol via B4 Relay
2025-03-07 17:46   ` Andy Shevchenko
2025-03-18 16:45   ` Yury Norov
2025-03-19  5:39     ` Vincent Mailhol
2025-03-19 13:24       ` Yury Norov
2025-03-07 16:48 ` [PATCH v6 3/7] bits: introduce fixed-type BIT_U*() Vincent Mailhol via B4 Relay
2025-03-07 17:48   ` Andy Shevchenko
2025-03-07 17:49     ` Andy Shevchenko
2025-03-08  9:28       ` Vincent Mailhol
2025-03-07 16:48 ` [PATCH v6 4/7] drm/i915: Convert REG_GENMASK*() to fixed-width GENMASK_U*() Vincent Mailhol via B4 Relay
2025-03-07 17:54   ` Andy Shevchenko
2025-03-08 10:36     ` Vincent Mailhol
2025-03-18 17:16   ` Yury Norov
2025-03-18 22:32     ` Jani Nikula
2025-03-19  4:37       ` Vincent Mailhol
2025-03-19 13:25         ` Yury Norov [this message]
2025-03-07 16:48 ` [PATCH v6 5/7] test_bits: add tests for __GENMASK() and __GENMASK_ULL() Vincent Mailhol via B4 Relay
2025-03-07 16:48 ` [PATCH v6 6/7] test_bits: add tests for GENMASK_U*() Vincent Mailhol via B4 Relay
2025-03-07 16:48 ` [PATCH v6 7/7] test_bits: add tests for BIT_U*() Vincent Mailhol via B4 Relay
2025-03-07 17:18 ` [PATCH v6 0/7] bits: Fixed-type GENMASK_U*() and BIT_U*() Yury Norov
2025-03-07 17:43   ` Andy Shevchenko
2025-03-07 17:48     ` Yury Norov
2025-03-07 17:50       ` Andy Shevchenko
2025-03-08 10:40         ` Vincent Mailhol

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Z9rF5JFcEW2DOtcr@thinkpad \
    --to=yury.norov@gmail.com \
    --cc=David.Laight@aculab.com \
    --cc=airlied@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=andi.shyti@linux.intel.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=dmitry.baryshkov@linaro.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jani.nikula@linux.intel.com \
    --cc=joonas.lahtinen@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@rasmusvillemoes.dk \
    --cc=lucas.demarchi@intel.com \
    --cc=mailhol.vincent@wanadoo.fr \
    --cc=rodrigo.vivi@intel.com \
    --cc=simona@ffwll.ch \
    --cc=tursulin@ursulin.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox