intel-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: "Hogander, Jouni" <jouni.hogander@intel.com>
To: "intel-xe@lists.freedesktop.org" <intel-xe@lists.freedesktop.org>,
	"Nikula, Jani" <jani.nikula@intel.com>,
	"intel-gfx@lists.freedesktop.org"
	<intel-gfx@lists.freedesktop.org>
Cc: "ville.syrjala@linux.intel.com" <ville.syrjala@linux.intel.com>,
	"Deak, Imre" <imre.deak@intel.com>
Subject: Re: [PATCH 19/20] drm/i915/ddi: prefer poll_timeout_us() over readx_poll_timeout()
Date: Thu, 4 Sep 2025 09:19:44 +0000	[thread overview]
Message-ID: <6ac11c4191a7b19f7257295f9b16e9f01f265c14.camel@intel.com> (raw)
In-Reply-To: <63b10a36c7ab545c640b24bc8fc007ce2ea74623.1756383233.git.jani.nikula@intel.com>

On Thu, 2025-08-28 at 15:21 +0300, Jani Nikula wrote:
> Unify on using poll_timeout_us() throughout instead of mixing with
> readx_poll_timeout(). While the latter can be ever so slightly
> simpler,
> they are both complicated enough that it's better to unify on one
> approach only.
> 
> While at it, better separate the handling of error returns from
> drm_dp_dpcd_readb() and the actual status byte. This is best achieved
> by
> inlining the read_fec_detected_status() function, and switching to
> drm_dp_dpcd_read_byte().
> 
> v2: Use drm_dp_dpcd_read_byte() (Imre)
> 
> Cc: Imre Deak <imre.deak@intel.com>
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>

Reviewed-by: Jouni Högander <jouni.hogander@intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_ddi.c | 32 ++++++++--------------
> --
>  1 file changed, 11 insertions(+), 21 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_ddi.c
> b/drivers/gpu/drm/i915/display/intel_ddi.c
> index 4e4ea3a0ff83..46017091bb0b 100644
> --- a/drivers/gpu/drm/i915/display/intel_ddi.c
> +++ b/drivers/gpu/drm/i915/display/intel_ddi.c
> @@ -2340,34 +2340,24 @@ static void
> intel_dp_sink_set_fec_ready(struct intel_dp *intel_dp,
>  		drm_dbg_kms(display->drm, "Failed to clear FEC
> detected flags\n");
>  }
>  
> -static int read_fec_detected_status(struct drm_dp_aux *aux)
> -{
> -	int ret;
> -	u8 status;
> -
> -	ret = drm_dp_dpcd_readb(aux, DP_FEC_STATUS, &status);
> -	if (ret < 0)
> -		return ret;
> -
> -	return status;
> -}
> -
>  static int wait_for_fec_detected(struct drm_dp_aux *aux, bool
> enabled)
>  {
>  	struct intel_display *display = to_intel_display(aux-
> >drm_dev);
>  	int mask = enabled ? DP_FEC_DECODE_EN_DETECTED :
> DP_FEC_DECODE_DIS_DETECTED;
> -	int status;
> -	int err;
> +	u8 status = 0;
> +	int ret, err;
>  
> -	err = readx_poll_timeout(read_fec_detected_status, aux,
> status,
> -				 status & mask || status < 0,
> -				 10000, 200000);
> +	ret = poll_timeout_us(err = drm_dp_dpcd_read_byte(aux,
> DP_FEC_STATUS, &status),
> +			      err || (status & mask),
> +			      10 * 1000, 200 * 1000, false);
>  
> -	if (err || status < 0) {
> +	/* Either can be non-zero, but not both */
> +	ret = ret ?: err;
> +	if (ret) {
>  		drm_dbg_kms(display->drm,
> -			    "Failed waiting for FEC %s to get
> detected: %d (status %d)\n",
> -			    str_enabled_disabled(enabled), err,
> status);
> -		return err ? err : status;
> +			    "Failed waiting for FEC %s to get
> detected: %d (status 0x%02x)\n",
> +			    str_enabled_disabled(enabled), ret,
> status);
> +		return ret;
>  	}
>  
>  	return 0;


  reply	other threads:[~2025-09-04  9:19 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-28 12:20 [PATCH 00/20] drm/i915/display: convert to generic poll_timeout_us() Jani Nikula
2025-08-28 12:20 ` [PATCH 01/20] drm/i915/hdmi: use generic poll_timeout_us() instead of __wait_for() Jani Nikula
2025-09-03 13:29   ` Hogander, Jouni
2025-09-04 11:26     ` Jani Nikula
2025-08-28 12:20 ` [PATCH 02/20] drm/i915/hdcp: " Jani Nikula
2025-09-03 13:42   ` Hogander, Jouni
2025-08-28 12:20 ` [PATCH 03/20] drm/i915/hdcp: use generic poll_timeout_us() instead of wait_for() Jani Nikula
2025-09-04  4:14   ` Hogander, Jouni
2025-08-28 12:20 ` [PATCH 04/20] drm/i915/dsi: use generic poll_timeout_us() instead of wait_for_us() Jani Nikula
2025-09-04  4:27   ` Hogander, Jouni
2025-08-28 12:20 ` [PATCH 05/20] drm/i915/dsi-pll: use generic poll_timeout_us() instead of wait_for() Jani Nikula
2025-09-04  4:34   ` Hogander, Jouni
2025-08-28 12:20 ` [PATCH 06/20] drm/i915/gmbus: use generic poll_timeout*() instead of wait_for*() Jani Nikula
2025-09-04  4:53   ` Hogander, Jouni
2025-08-28 12:20 ` [PATCH 07/20] drm/i915/wm: use generic poll_timeout_us() instead of wait_for() Jani Nikula
2025-09-04  5:01   ` Hogander, Jouni
2025-08-28 12:20 ` [PATCH 08/20] drm/i915/cdclk: " Jani Nikula
2025-09-04  5:45   ` Hogander, Jouni
2025-08-28 12:20 ` [PATCH 09/20] drm/i915/power: " Jani Nikula
2025-09-04  5:47   ` Hogander, Jouni
2025-08-28 12:20 ` [PATCH 10/20] drm/i915/power-well: use generic poll_timeout_us() instead of wait_for() for DKL PHY Jani Nikula
2025-09-04  5:48   ` Hogander, Jouni
2025-08-28 12:20 ` [PATCH 11/20] drm/i915/power-well: use generic poll_timeout_us() instead of wait_for() for VLV/CHV Jani Nikula
2025-09-04  5:54   ` Hogander, Jouni
2025-08-28 12:20 ` [PATCH 12/20] drm/i915/dp: use generic poll_timeout_us() instead of wait_for() Jani Nikula
2025-09-04  6:08   ` Hogander, Jouni
2025-08-28 12:20 ` [PATCH 13/20] drm/i915/dp: use generic poll_timeout_us() instead of wait_for() in link training Jani Nikula
2025-09-04  6:15   ` Hogander, Jouni
2025-08-28 12:20 ` [PATCH 14/20] drm/i915/vblank: use generic poll_timeout_us() instead of wait_for() Jani Nikula
2025-09-04  8:05   ` Hogander, Jouni
2025-08-28 12:20 ` [PATCH 15/20] drm/i915/tc: " Jani Nikula
2025-09-04  8:41   ` Hogander, Jouni
2025-08-28 12:20 ` [PATCH 16/20] drm/i915/dsb: " Jani Nikula
2025-09-04  8:42   ` Hogander, Jouni
2025-08-28 12:20 ` [PATCH 17/20] drm/i915/lspcon: " Jani Nikula
2025-09-04  8:47   ` Hogander, Jouni
2025-08-28 12:21 ` [PATCH 18/20] drm/i915/opregion: " Jani Nikula
2025-09-04  9:06   ` Hogander, Jouni
2025-08-28 12:21 ` [PATCH 19/20] drm/i915/ddi: prefer poll_timeout_us() over readx_poll_timeout() Jani Nikula
2025-09-04  9:19   ` Hogander, Jouni [this message]
2025-08-28 12:21 ` [PATCH 20/20] drm/i915/pps: prefer poll_timeout_us() over read_poll_timeout() Jani Nikula
2025-09-04 10:23   ` Hogander, Jouni
2025-08-28 17:44 ` ✓ i915.CI.BAT: success for drm/i915/display: convert to generic poll_timeout_us() Patchwork
2025-08-29  0:27 ` ✗ i915.CI.Full: failure " 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=6ac11c4191a7b19f7257295f9b16e9f01f265c14.camel@intel.com \
    --to=jouni.hogander@intel.com \
    --cc=imre.deak@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=jani.nikula@intel.com \
    --cc=ville.syrjala@linux.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;
as well as URLs for NNTP newsgroup(s).