Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@linux.intel.com>
To: Gil Dekel <gildekel@chromium.org>,
	intel-gfx@lists.freedesktop.org, seanpaul@chromium.org,
	navaremanasi@chromium.org
Cc: Gil Dekel <gildekel@chromium.org>, Rodrigo Vivi <rodrigo.vivi@intel.com>
Subject: Re: [Intel-gfx] [PATCH] drm/i915/tc: Use standard ternary operator instead of GCC extension
Date: Fri, 09 Jun 2023 12:15:42 +0300	[thread overview]
Message-ID: <87v8fxq9mp.fsf@intel.com> (raw)
In-Reply-To: <20230608220037.1555814-1-gildekel@chromium.org>

On Thu, 08 Jun 2023, Gil Dekel <gildekel@chromium.org> wrote:
> The ternary expression:
>
>   x ? : y
>
> is a GCC extension and is not a part of C/C++ standard.
>
> Use the canonical form instead to reduce dependency over GCC extension.

Thanks for the patch, but no thanks, we'll keep it as it is.

It's acceptable use of GCC extensions in kernel, it's supported by both
GCC and Clang, and there are thousands of uses of uses in kernel, and
dozens in i915 alone. I don't want to open the door for an influx of
patches changing this.

Besides, it's one of the better GCC extensions there is, avoiding the
unnecessary duplication and verbosity.


BR,
Jani.

>
> Signed-off-by: Gil Dekel <gildekel@chromium.org>
> ---
>  drivers/gpu/drm/i915/display/intel_display_power_well.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_display_power_well.c b/drivers/gpu/drm/i915/display/intel_display_power_well.c
> index 916009894d89c..39d0dbad589bf 100644
> --- a/drivers/gpu/drm/i915/display/intel_display_power_well.c
> +++ b/drivers/gpu/drm/i915/display/intel_display_power_well.c
> @@ -255,7 +255,9 @@ static void hsw_wait_for_power_well_enable(struct drm_i915_private *dev_priv,
>  {
>  	const struct i915_power_well_regs *regs = power_well->desc->ops->regs;
>  	int pw_idx = i915_power_well_instance(power_well)->hsw.idx;
> -	int timeout = power_well->desc->enable_timeout ? : 1;
> +	int timeout = power_well->desc->enable_timeout ?
> +			      power_well->desc->enable_timeout :
> +			      1;
>
>  	/*
>  	 * For some power wells we're not supposed to watch the status bit for
> --
> Gil Dekel, Software Engineer, Google / ChromeOS Display and Graphics

-- 
Jani Nikula, Intel Open Source Graphics Center

  parent reply	other threads:[~2023-06-09  9:15 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-08 22:00 [Intel-gfx] [PATCH] drm/i915/tc: Use standard ternary operator instead of GCC extension Gil Dekel
2023-06-08 23:00 ` [Intel-gfx] ✓ Fi.CI.BAT: success for " Patchwork
2023-06-09  9:15 ` Jani Nikula [this message]
2023-06-10  7:58 ` [Intel-gfx] ✓ Fi.CI.IGT: " 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=87v8fxq9mp.fsf@intel.com \
    --to=jani.nikula@linux.intel.com \
    --cc=gildekel@chromium.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=navaremanasi@chromium.org \
    --cc=rodrigo.vivi@intel.com \
    --cc=seanpaul@chromium.org \
    /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