Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@intel.com>
To: Vivek Kasireddy <vivek.kasireddy@intel.com>,
	intel-gfx@lists.freedesktop.org
Subject: Re: [Intel-gfx] [PATCH] drm/i915/ddi: Ensure that the value assigned to ddi_clk_needed is a bool
Date: Thu, 30 Jan 2020 11:41:19 +0200	[thread overview]
Message-ID: <875zgtb7sw.fsf@intel.com> (raw)
In-Reply-To: <20200129220540.7608-1-vivek.kasireddy@intel.com>

On Wed, 29 Jan 2020, Vivek Kasireddy <vivek.kasireddy@intel.com> wrote:
> Currently, the value assigned to the bool variable ddi_clk_needed
> is a pointer -- which appears to have happened inadvertently. Therefore,
> add a "!!" before the expression on the right to ensure that it results
> in a bool.

Please don't do this.

The !! is only needed for compressing the value to 0 or 1 when the left
operand is not a bool. It was customary in the days of yore when bool
was just a typedeffed int.

For standard bools, "When any scalar value is converted to _Bool, the
result is 0 if the value compares equal to 0; otherwise, the result is
1."

BR,
Jani.


>
> Cc: Jani Nikula <jani.nikula@intel.com>
> Signed-off-by: Vivek Kasireddy <vivek.kasireddy@intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_ddi.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_ddi.c b/drivers/gpu/drm/i915/display/intel_ddi.c
> index c96f629cddc3..6df485289bc6 100644
> --- a/drivers/gpu/drm/i915/display/intel_ddi.c
> +++ b/drivers/gpu/drm/i915/display/intel_ddi.c
> @@ -3109,7 +3109,7 @@ void icl_sanitize_encoder_pll_mapping(struct intel_encoder *encoder)
>  	}
>  
>  	port_mask = BIT(encoder->port);
> -	ddi_clk_needed = encoder->base.crtc;
> +	ddi_clk_needed = !!encoder->base.crtc;
>  
>  	if (encoder->type == INTEL_OUTPUT_DSI) {
>  		struct intel_encoder *other_encoder;

-- 
Jani Nikula, Intel Open Source Graphics Center
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

      parent reply	other threads:[~2020-01-30  9:41 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-29 22:05 [Intel-gfx] [PATCH] drm/i915/ddi: Ensure that the value assigned to ddi_clk_needed is a bool Vivek Kasireddy
2020-01-30  3:09 ` [Intel-gfx] ✗ Fi.CI.BAT: failure for " Patchwork
2020-01-30  9:41 ` Jani Nikula [this message]

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=875zgtb7sw.fsf@intel.com \
    --to=jani.nikula@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=vivek.kasireddy@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox