From 4aa1f3ac5767de806de6744a95227e27c6118b16 Mon Sep 17 00:00:00 2001 From: =?utf8?q?St=C3=A9phane=20Marchesin?= Date: Tue, 18 Dec 2012 14:08:16 -0800 Subject: [PATCH] drm/i915: Make intel_dp_aux_native_read timeout MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Some adapters return DEFER indefinitely, which results in being stuck in the kernel, which triggers the watchdog, which reboots. To avoid this, limit to 100 tries, after which we return an error and pring a message. BUG=chrome-os-partner:15612 TEST=by hand, use the apple miniDP to dual-link adapter, plug a 30 inch TEST=monitor, the machine shouldn't reboot spontaneously (the monitor still TEST=won't work, but that is a separate bug). Change-Id: I842f6edd0da3b67eab8613410bf61474fc40ba7a Reviewed-on: https://gerrit.chromium.org/gerrit/39888 Tested-by: Stéphane Marchesin Reviewed-by: Stuart Abercrombie Commit-Ready: Stéphane Marchesin --- drivers/gpu/drm/i915/intel_dp.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index 6d9cbe55bd397..9837f9050c679 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c @@ -538,6 +538,7 @@ intel_dp_aux_native_read(struct intel_dp *intel_dp, int reply_bytes; uint8_t ack; int ret; + int try; intel_dp_check_edp(intel_dp); msg[0] = AUX_NATIVE_READ << 4; @@ -548,7 +549,7 @@ intel_dp_aux_native_read(struct intel_dp *intel_dp, msg_bytes = 4; reply_bytes = recv_bytes + 1; - for (;;) { + for (try = 0; try < 100; try++) { ret = intel_dp_aux_ch(intel_dp, msg, msg_bytes, reply, reply_bytes); if (ret == 0) @@ -565,6 +566,9 @@ intel_dp_aux_native_read(struct intel_dp *intel_dp, else return -EIO; } + + DRM_ERROR("too many retries, giving up\n"); + return -EREMOTEIO; } static int -- 2.39.5