From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Gustavo Sousa <gustavo.sousa@intel.com>
Cc: intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org,
Jani Nikula <jani.nikula@intel.com>
Subject: Re: [PATCH v2 1/2] drm/i915/display: Use explicit cast in POWER_DOMAIN_*() macros
Date: Wed, 12 Feb 2025 19:52:19 +0200 [thread overview]
Message-ID: <Z6zf00kDlmteGiIq@intel.com> (raw)
In-Reply-To: <20250212174333.371681-2-gustavo.sousa@intel.com>
On Wed, Feb 12, 2025 at 02:43:16PM -0300, Gustavo Sousa wrote:
> Let the compiler know that we are intetionally using a different enum
> type to perform arithmetic with enum intel_display_power_domain in the
> POWER_DOMAIN_*(). Do that by explicitly casting the macro argument to
> int.
>
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202502120809.XfmcqkBD-lkp@intel.com/
> Signed-off-by: Gustavo Sousa <gustavo.sousa@intel.com>
> ---
> drivers/gpu/drm/i915/display/intel_display_power.h | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_display_power.h b/drivers/gpu/drm/i915/display/intel_display_power.h
> index a3a5c1be8bab..3caa3f517a32 100644
> --- a/drivers/gpu/drm/i915/display/intel_display_power.h
> +++ b/drivers/gpu/drm/i915/display/intel_display_power.h
> @@ -117,12 +117,12 @@ enum intel_display_power_domain {
> POWER_DOMAIN_INVALID = POWER_DOMAIN_NUM,
> };
>
> -#define POWER_DOMAIN_PIPE(pipe) ((pipe) + POWER_DOMAIN_PIPE_A)
> +#define POWER_DOMAIN_PIPE(pipe) ((int)(pipe) + POWER_DOMAIN_PIPE_A)
> #define POWER_DOMAIN_PIPE_PANEL_FITTER(pipe) \
> - ((pipe) + POWER_DOMAIN_PIPE_PANEL_FITTER_A)
> + ((int)(pipe) + POWER_DOMAIN_PIPE_PANEL_FITTER_A)
> #define POWER_DOMAIN_TRANSCODER(tran) \
> ((tran) == TRANSCODER_EDP ? POWER_DOMAIN_TRANSCODER_EDP : \
> - (tran) + POWER_DOMAIN_TRANSCODER_A)
> + (int)(tran) + POWER_DOMAIN_TRANSCODER_A)
I've generally gone for the
POWER_DOMAIN_TRANSCODER_A + (tran) - TRANSCODER_A
form for such things, to also make sure it works
even if TRANSCODER_A isn't 0 anymore.
Does that avoid the warning as well?
Maybe these should even be functions rather than macros?
>
> struct intel_power_domain_mask {
> DECLARE_BITMAP(bits, POWER_DOMAIN_NUM);
> --
> 2.48.1
--
Ville Syrjälä
Intel
next prev parent reply other threads:[~2025-02-12 17:52 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-12 17:43 [PATCH v2 0/2] Improve type-safety on POWER_DOMAIN_*() macros Gustavo Sousa
2025-02-12 17:43 ` [PATCH v2 1/2] drm/i915/display: Use explicit cast in " Gustavo Sousa
2025-02-12 17:52 ` Ville Syrjälä [this message]
2025-02-12 17:59 ` Gustavo Sousa
2025-02-12 18:44 ` Gustavo Sousa
2025-02-12 18:55 ` Ville Syrjälä
2025-02-12 19:02 ` Gustavo Sousa
2025-02-12 17:43 ` [PATCH v2 2/2] drm/i915/display: Make POWER_DOMAIN_*() always result in enum intel_display_power_domain Gustavo Sousa
2025-02-12 21:26 ` ✓ CI.Patch_applied: success for Improve type-safety on POWER_DOMAIN_*() macros (rev2) Patchwork
2025-02-12 21:26 ` ✓ CI.checkpatch: " Patchwork
2025-02-12 21:27 ` ✓ CI.KUnit: " Patchwork
2025-02-12 21:44 ` ✓ CI.Build: " Patchwork
2025-02-12 21:46 ` ✓ CI.Hooks: " Patchwork
2025-02-12 21:48 ` ✓ CI.checksparse: " Patchwork
2025-02-12 22:07 ` ✓ Xe.CI.BAT: " Patchwork
2025-02-12 23:28 ` ✗ Fi.CI.SPARSE: warning " Patchwork
2025-02-12 23:45 ` ✗ i915.CI.BAT: failure " Patchwork
2025-02-13 7:46 ` ✗ Xe.CI.Full: " Patchwork
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=Z6zf00kDlmteGiIq@intel.com \
--to=ville.syrjala@linux.intel.com \
--cc=gustavo.sousa@intel.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=intel-xe@lists.freedesktop.org \
--cc=jani.nikula@intel.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.