]> xenbits.xensource.com Git - people/aperard/linux-chromebook.git/commitdiff
drm/i915: Make intel_dp_aux_native_read timeout
authorStéphane Marchesin <marcheu@chromium.org>
Tue, 18 Dec 2012 22:08:16 +0000 (14:08 -0800)
committerGerrit <chrome-bot@google.com>
Tue, 18 Dec 2012 23:24:33 +0000 (15:24 -0800)
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 <marcheu@chromium.org>
Reviewed-by: Stuart Abercrombie <sabercrombie@chromium.org>
Commit-Ready: Stéphane Marchesin <marcheu@chromium.org>

drivers/gpu/drm/i915/intel_dp.c

index 6d9cbe55bd397fdb94c3ba9ab4ce935a4d886149..9837f9050c67959d9cdb546c7555fedf7a82b114 100644 (file)
@@ -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