mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Louis Chauvet <louis.chauvet@bootlin.com>
To: Maxime Ripard <mripard@kernel.org>,
	Jyri Sarha <jyri.sarha@iki.fi>,
	Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>,
	Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	Thomas Zimmermann <tzimmermann@suse.de>,
	David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>
Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 00/14] drm/tidss: dispc: Convert to FIELD_* API
Date: Thu, 31 Jul 2025 15:04:49 +0200	[thread overview]
Message-ID: <15f0b568-3d59-4f0c-b390-4e3d3623136a@bootlin.com> (raw)
In-Reply-To: <20250730-drm-tidss-field-api-v1-0-a71ae8dd2782@kernel.org>



Le 30/07/2025 à 10:57, Maxime Ripard a écrit :
> Hi,
> 
> The tidss driver rolls its own API equivalent to the FIELD_* API already
> provided the kernel.
> 
> Since it's an ad-hoc implementation, it also is less convenient and
> doesn't provide some useful features like being able to share the field
> definitions that will come handy in the future.
> 
> Thus, this series converts the driver to that API and drops its own
> version.

Hi,

I just saw your series after sending mine [2]. I checked, there is only 
one minor conflict that can be easly fixed.

But when applied on drm-misc/drm-misc-next, your series raises:

In file included from <command-line>:
drivers/gpu/drm/tidss/tidss_dispc.c: In function 'FLD_MOD':
././include/linux/compiler_types.h:568:45: error: call to 
'__compiletime_assert_589' declared with attribute error: FIELD_PREP: 
mask is not constant
   568 |         _compiletime_assert(condition, msg, 
__compiletime_assert_, __COUNTER__)
       |                                             ^
././include/linux/compiler_types.h:549:25: note: in definition of macro 
'__compiletime_assert'
   549 |                         prefix ## suffix(); 
         \
       |                         ^~~~~~
././include/linux/compiler_types.h:568:9: note: in expansion of macro 
'_compiletime_assert'
   568 |         _compiletime_assert(condition, msg, 
__compiletime_assert_, __COUNTER__)
       |         ^~~~~~~~~~~~~~~~~~~
./include/linux/build_bug.h:39:37: note: in expansion of macro 
'compiletime_assert'
    39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), 
msg)
       |                                     ^~~~~~~~~~~~~~~~~~
./include/linux/bitfield.h:65:17: note: in expansion of macro 
'BUILD_BUG_ON_MSG'
    65 |                 BUILD_BUG_ON_MSG(!__builtin_constant_p(_mask), 
         \
       |                 ^~~~~~~~~~~~~~~~
./include/linux/bitfield.h:115:17: note: in expansion of macro 
'__BF_FIELD_CHECK'
   115 |                 __BF_FIELD_CHECK(_mask, 0ULL, _val, 
"FIELD_PREP: ");    \
       |                 ^~~~~~~~~~~~~~~~
drivers/gpu/drm/tidss/tidss_dispc.c:599:33: note: in expansion of macro 
'FIELD_PREP'
   599 |         return (orig & ~mask) | FIELD_PREP(mask, val);
       |                                 ^~~~~~~~~~


This seems to be a limitation of FIELD_PREP [1].
I think the only way to avoid this issue is to use macros and not functions.

[1]:https://elixir.bootlin.com/linux/v6.16/source/include/linux/bitfield.h#L65-L66
[2]:https://lore.kernel.org/all/20250730-fix-edge-handling-v1-0-1bdfb3fe7922@bootlin.com/


Thanks,
Louis Chauvet

> Let me know what you think,
> Maxime
> 
> Signed-off-by: Maxime Ripard <mripard@kernel.org>
> ---
> Maxime Ripard (14):
>        drm/tidss: dispc: Remove unused OVR_REG_GET
>        drm/tidss: dispc: Switch to GENMASK instead of FLD_MASK
>        drm/tidss: dispc: Switch to FIELD_PREP for FLD_VAL
>        drm/tidss: dispc: Get rid of FLD_GET
>        drm/tidss: dispc: Get rid of FLD_VAL
>        drm/tidss: dispc: Switch FLD_MOD to using a mask
>        drm/tidss: dispc: Switch REG_GET to using a mask
>        drm/tidss: dispc: Switch REG_FLD_MOD to using a mask
>        drm/tidss: dispc: Switch VID_REG_GET to using a mask
>        drm/tidss: dispc: Switch VID_REG_FLD_MOD to using a mask
>        drm/tidss: dispc: Switch VP_REG_GET to using a mask
>        drm/tidss: dispc: Switch VP_REG_FLD_MOD to using a mask
>        drm/tidss: dispc: Switch OVR_REG_FLD_MOD to using a mask
>        drm/tidss: dispc: Define field masks being used
> 
>   drivers/gpu/drm/tidss/tidss_dispc.c      | 249 +++++++++++++++----------------
>   drivers/gpu/drm/tidss/tidss_dispc_regs.h |  76 ++++++++++
>   2 files changed, 200 insertions(+), 125 deletions(-)
> ---
> base-commit: fbb0210d25fde20027f86a6ca9eee75630b5ac2b
> change-id: 20250729-drm-tidss-field-api-382947a92d44
> 
> Best regards,

-- 
Louis Chauvet, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com


  parent reply	other threads:[~2025-07-31 13:04 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-30  8:57 Maxime Ripard
2025-07-30  8:57 ` [PATCH 01/14] drm/tidss: dispc: Remove unused OVR_REG_GET Maxime Ripard
2025-07-30  8:57 ` [PATCH 02/14] drm/tidss: dispc: Switch to GENMASK instead of FLD_MASK Maxime Ripard
2025-07-30  8:57 ` [PATCH 03/14] drm/tidss: dispc: Switch to FIELD_PREP for FLD_VAL Maxime Ripard
2025-07-30  8:57 ` [PATCH 04/14] drm/tidss: dispc: Get rid of FLD_GET Maxime Ripard
2025-07-30  8:57 ` [PATCH 05/14] drm/tidss: dispc: Get rid of FLD_VAL Maxime Ripard
2025-07-30  8:57 ` [PATCH 06/14] drm/tidss: dispc: Switch FLD_MOD to using a mask Maxime Ripard
2025-07-30  8:57 ` [PATCH 07/14] drm/tidss: dispc: Switch REG_GET " Maxime Ripard
2025-07-30  8:57 ` [PATCH 08/14] drm/tidss: dispc: Switch REG_FLD_MOD " Maxime Ripard
2025-07-30  8:57 ` [PATCH 09/14] drm/tidss: dispc: Switch VID_REG_GET " Maxime Ripard
2025-07-30  8:57 ` [PATCH 10/14] drm/tidss: dispc: Switch VID_REG_FLD_MOD " Maxime Ripard
2025-07-30  8:57 ` [PATCH 11/14] drm/tidss: dispc: Switch VP_REG_GET " Maxime Ripard
2025-07-30  8:57 ` [PATCH 12/14] drm/tidss: dispc: Switch VP_REG_FLD_MOD " Maxime Ripard
2025-07-30  8:57 ` [PATCH 13/14] drm/tidss: dispc: Switch OVR_REG_FLD_MOD " Maxime Ripard
2025-07-30  8:57 ` [PATCH 14/14] drm/tidss: dispc: Define field masks being used Maxime Ripard
2025-07-31 13:04 ` Louis Chauvet [this message]
2025-07-31 13:26   ` [PATCH 00/14] drm/tidss: dispc: Convert to FIELD_* API Maxime Ripard
2025-07-31 13:49     ` Louis Chauvet
2025-07-31 14:05       ` Maxime Ripard
2025-08-08  9:34 ` Tomi Valkeinen

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=15f0b568-3d59-4f0c-b390-4e3d3623136a@bootlin.com \
    --to=louis.chauvet@bootlin.com \
    --cc=airlied@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jyri.sarha@iki.fi \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    --cc=simona@ffwll.ch \
    --cc=tomi.valkeinen@ideasonboard.com \
    --cc=tzimmermann@suse.de \
    /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

all inboxes | Powered by JetHome®