Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/external/bsd/drm2/dist/drm/i915/display i915: Fix some t...
details: https://anonhg.NetBSD.org/src/rev/5d7560317254
branches: trunk
changeset: 1028997:5d7560317254
user: riastradh <riastradh%NetBSD.org@localhost>
date: Sun Dec 19 12:40:31 2021 +0000
description:
i915: Fix some timeout return values in gmbus and dp logic.
diffstat:
sys/external/bsd/drm2/dist/drm/i915/display/intel_dp.c | 16 +++---
sys/external/bsd/drm2/dist/drm/i915/display/intel_gmbus.c | 34 ++++++++++++++-
2 files changed, 40 insertions(+), 10 deletions(-)
diffs (99 lines):
diff -r 017a37ce26cb -r 5d7560317254 sys/external/bsd/drm2/dist/drm/i915/display/intel_dp.c
--- a/sys/external/bsd/drm2/dist/drm/i915/display/intel_dp.c Sun Dec 19 12:40:21 2021 +0000
+++ b/sys/external/bsd/drm2/dist/drm/i915/display/intel_dp.c Sun Dec 19 12:40:31 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: intel_dp.c,v 1.5 2021/12/19 12:03:57 riastradh Exp $ */
+/* $NetBSD: intel_dp.c,v 1.6 2021/12/19 12:40:31 riastradh Exp $ */
/*
* Copyright © 2008 Intel Corporation
@@ -28,7 +28,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: intel_dp.c,v 1.5 2021/12/19 12:03:57 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intel_dp.c,v 1.6 2021/12/19 12:40:31 riastradh Exp $");
#include <linux/export.h>
#include <linux/i2c.h>
@@ -1197,12 +1197,12 @@
&i915->gmbus_wait_queue, &i915->gmbus_wait_lock,
msecs_to_jiffies_timeout(timeout_ms),
C);
- if (ret < 0) /* Failure: pretend same as done. */
- done = true;
- else if (ret == 0) /* Timed out: not done. */
- done = false;
- else /* Succeeded (ret > 0): done. */
- done = true;
+ /*
+ * ret<0 on error (-ERESTARTSYS, interrupt); ret=0 on
+ * timeout; ret>0 on success. We care about success
+ * only.
+ */
+ done = (ret > 0);
spin_unlock(&i915->gmbus_wait_lock);
} else {
done = wait_for_atomic(C, timeout_ms) == 0;
diff -r 017a37ce26cb -r 5d7560317254 sys/external/bsd/drm2/dist/drm/i915/display/intel_gmbus.c
--- a/sys/external/bsd/drm2/dist/drm/i915/display/intel_gmbus.c Sun Dec 19 12:40:21 2021 +0000
+++ b/sys/external/bsd/drm2/dist/drm/i915/display/intel_gmbus.c Sun Dec 19 12:40:31 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: intel_gmbus.c,v 1.3 2021/12/19 11:45:01 riastradh Exp $ */
+/* $NetBSD: intel_gmbus.c,v 1.4 2021/12/19 12:40:31 riastradh Exp $ */
/*
* Copyright (c) 2006 Dave Airlie <airlied%linux.ie@localhost>
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: intel_gmbus.c,v 1.3 2021/12/19 11:45:01 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intel_gmbus.c,v 1.4 2021/12/19 12:40:31 riastradh Exp $");
#include <linux/export.h>
#include <linux/i2c-algo-bit.h>
@@ -371,6 +371,21 @@
GMBUS2))
& GMBUS_ACTIVE)
== 0));
+ /*
+ * After DRM_SPIN_TIMED_WAIT_NOINTR_UNTIL, ret<0 on
+ * error (-ERESTARTSYS, interrupt), ret=0 on timeout,
+ * ret>0 on success (time remaining).
+ *
+ * We want ret=-ETIMEDOUT on timeout and ret=0 on
+ * success.
+ */
+ if (ret < 0) {
+ /* error */
+ } else if (ret == 0) {
+ ret = -ETIMEDOUT;
+ } else {
+ ret = 0;
+ }
}
I915_WRITE_FW(GMBUS4, 0);
@@ -420,6 +435,21 @@
((intel_uncore_read_fw(&dev_priv->uncore, GMBUS2)
& GMBUS_ACTIVE)
== 0));
+ /*
+ * After DRM_SPIN_TIMED_WAIT_NOINTR_UNTIL, ret<0 on
+ * error (-ERESTARTSYS, interrupt), ret=0 on timeout,
+ * ret>0 on success (time remaining).
+ *
+ * We want ret=-ETIMEDOUT on timeout and ret=0 on
+ * success.
+ */
+ if (ret < 0) {
+ /* error */
+ } else if (ret == 0) {
+ ret = -ETIMEDOUT;
+ } else {
+ ret = 0;
+ }
}
I915_WRITE_FW(GMBUS4, 0);
Home |
Main Index |
Thread Index |
Old Index