[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1332934765_126523@CP5-2952>
Date: Wed, 28 Mar 2012 12:39:12 +0100
From: Chris Wilson <chris@...is-wilson.co.uk>
To: Daniel Kurtz <djkurtz@...omium.org>
Cc: Daniel Vetter <daniel@...ll.ch>, Keith Packard <keithp@...thp.com>,
David Airlie <airlied@...ux.ie>,
dri-devel@...ts.freedesktop.org, linux-kernel@...r.kernel.org,
Benson Leung <bleung@...omium.org>,
Yufeng Shen <miletus@...omium.org>
Subject: Re: [PATCH 08/13 v4] drm/i915/intel_i2c: handle zero-length writes
On Wed, 28 Mar 2012 19:32:27 +0800, Daniel Kurtz <djkurtz@...omium.org> wrote:
> Unfortunately there is a bug in both my original patch (it wasn't
> incrementing loop), and in your suggested cleanup (it always
> decrements len, even when it is already 0... or if the loop test
> fails). How about the following; despite its pythonic nature, it
> always completes with len holding the number of bytes remaining.
>
> val = loop = 0;
> while (len && loop < 4) {
> val |= *buf++ << (8 * loop++);
> len -= 1;
> }
I'm getting over my aversion ;-)
As we are here, have you considered doing an optimised u32 variant whilst
len >= 4, which should be reasonably common during EDID transfer. Though
I am not sure if that loop is merely in the noise compared to the rest of
the mmio.
-Chris
--
Chris Wilson, Intel Open Source Technology Centre
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists