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 Match Linux's wait for g...



details:   https://anonhg.NetBSD.org/src/rev/afbe9b62a4fe
branches:  trunk
changeset: 336408:afbe9b62a4fe
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sat Feb 28 14:10:00 2015 +0000

description:
Match Linux's wait for gmbus a little more precisely.

Don't just wait up to 50 ms for a gmbus interrupt -- poll every tick
for >=50 ms.

diffstat:

 sys/external/bsd/drm2/dist/drm/i915/intel_i2c.c |  24 +++++++++++++-----------
 1 files changed, 13 insertions(+), 11 deletions(-)

diffs (48 lines):

diff -r c5da9cc140b1 -r afbe9b62a4fe sys/external/bsd/drm2/dist/drm/i915/intel_i2c.c
--- a/sys/external/bsd/drm2/dist/drm/i915/intel_i2c.c   Sat Feb 28 13:57:08 2015 +0000
+++ b/sys/external/bsd/drm2/dist/drm/i915/intel_i2c.c   Sat Feb 28 14:10:00 2015 +0000
@@ -264,9 +264,7 @@
                     u32 gmbus2_status,
                     u32 gmbus4_irq_en)
 {
-#ifndef __NetBSD__
        int i;
-#endif
        int reg_offset = dev_priv->gpio_mmio_base;
        u32 gmbus2 = 0;
 #ifndef __NetBSD__
@@ -289,21 +287,25 @@
 #ifdef __NetBSD__
        spin_lock(&dev_priv->gmbus_wait_lock);
        if (cold) {
-               unsigned timo = 50;
-
+               i = 50;
                while (gmbus2 = I915_READ_NOTRACE(GMBUS2 + reg_offset),
                    !ISSET(gmbus2, (GMBUS_SATOER | gmbus2_status))) {
-                       if (timo-- == 0)
+                       if (i-- == 0)
                                break;
                        DELAY(1000);
                }
        } else {
-               int ret;
-               DRM_SPIN_TIMED_WAIT_NOINTR_UNTIL(ret,
-                   &dev_priv->gmbus_wait_queue, &dev_priv->gmbus_wait_lock,
-                   mstohz(50),
-                   (gmbus2 = I915_READ_NOTRACE(GMBUS2 + reg_offset),
-                       ISSET(gmbus2, (GMBUS_SATOER | gmbus2_status))));
+               for (i = 0; i < mstohz(50); i++) {
+                       int ret;
+
+                       DRM_SPIN_TIMED_WAIT_NOINTR_UNTIL(ret,
+                           &dev_priv->gmbus_wait_queue,
+                           &dev_priv->gmbus_wait_lock,
+                           1,
+                           (gmbus2 = I915_READ_NOTRACE(GMBUS2 + reg_offset),
+                               ISSET(gmbus2,
+                                   (GMBUS_SATOER | gmbus2_status))));
+               }
        }
        spin_unlock(&dev_priv->gmbus_wait_lock);
 #else



Home | Main Index | Thread Index | Old Index