Re: [PATCH] drm/i915/tc: Use standard ternary operator instead of GCC extension

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 08 Jun 2023, Gil Dekel <gildekel@xxxxxxxxxxxx> 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@xxxxxxxxxxxx>
> ---
>  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



[Index of Archives]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux