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 Write the loops the same...



details:   https://anonhg.NetBSD.org/src/rev/c2b3a0885fce
branches:  trunk
changeset: 336553:c2b3a0885fce
user:      christos <christos%NetBSD.org@localhost>
date:      Thu Mar 05 21:13:48 2015 +0000

description:
Write the loops the same way, leaving i containing the number of tries
left. Also break early in the hot case.

diffstat:

 sys/external/bsd/drm2/dist/drm/i915/intel_i2c.c |  15 +++++++++------
 1 files changed, 9 insertions(+), 6 deletions(-)

diffs (35 lines):

diff -r dfc9eb9f6a9c -r c2b3a0885fce sys/external/bsd/drm2/dist/drm/i915/intel_i2c.c
--- a/sys/external/bsd/drm2/dist/drm/i915/intel_i2c.c   Thu Mar 05 20:19:30 2015 +0000
+++ b/sys/external/bsd/drm2/dist/drm/i915/intel_i2c.c   Thu Mar 05 21:13:48 2015 +0000
@@ -287,14 +287,15 @@
 #ifdef __NetBSD__
        if (cold) {
                i = 50;
-               while (gmbus2 = I915_READ_NOTRACE(GMBUS2 + reg_offset),
-                   !ISSET(gmbus2, (GMBUS_SATOER | gmbus2_status))) {
-                       if (i-- == 0)
+               do {
+                       gmbus2 = I915_READ_NOTRACE(GMBUS2 + reg_offset);
+                       if (ISSET(gmbus2, (GMBUS_SATOER | gmbus2_status)))
                                break;
                        DELAY(1000);
-               }
+               } while (i-- > 0);
        } else {
-               for (i = 0; i < mstohz(50); i++) {
+               i = mstohz(50);
+               do {
                        int ret;
 
                        spin_lock(&dev_priv->gmbus_wait_lock);
@@ -306,7 +307,9 @@
                                ISSET(gmbus2,
                                    (GMBUS_SATOER | gmbus2_status))));
                        spin_unlock(&dev_priv->gmbus_wait_lock);
-               }
+                       if (ret)
+                               break;
+               } while (i-- > 0);
        }
 #else
        for (i = 0; i < msecs_to_jiffies_timeout(50); i++) {



Home | Main Index | Thread Index | Old Index