- Doing earlier return when not busy - using u32 instead of uint32_t - counting from 3 to 0 as it is is the most common in the driver - using DRM_WARN() instead of WARN() - adding aux port name to the debug message - nuking last_status, it is one static variable to all DP ports also 2 different aux transactions with the same message size would have the same ch_ctl value, if really desired to reduce the number of debug messages it should be implemented a per aux ch last_status - no need to sleep in the last try - sleeping for 1 aux ch transaction time Signed-off-by: José Roberto de Souza <jose.souza@xxxxxxxxx> Cc: Dhinakaran Pandiyan <dhinakaran.pandiyan@xxxxxxxxx> --- New patch in this series. drivers/gpu/drm/i915/intel_dp.c | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index a11465c62950..258e23961456 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c @@ -1068,28 +1068,21 @@ static bool intel_dp_aux_is_busy(struct intel_dp *intel_dp) struct drm_i915_private *dev_priv = to_i915(intel_dig_port->base.base.dev); i915_reg_t ch_ctl; - uint32_t status; - int try; + u32 status; + unsigned int try; ch_ctl = intel_dp->aux_ch_ctl_reg(intel_dp); - for (try = 0; try < 3; try++) { + for (try = 3; try; try--) { status = I915_READ_NOTRACE(ch_ctl); if ((status & DP_AUX_CH_CTL_SEND_BUSY) == 0) - break; - msleep(1); + return false; + if (try > 1) + usleep_range(400, 500); } - if (try == 3) { - static u32 last_status = -1; - const u32 status = I915_READ(ch_ctl); - - if (status != last_status) { - WARN(1, "dp_aux_ch not started status 0x%08x\n", - status); - last_status = status; - } - } + DRM_WARN("DP aux %c is busy 0x%08x\n", + aux_ch_name(intel_dp->aux_ch), status); return true; } -- 2.17.0 _______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/intel-gfx