From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dmitry Torokhov Subject: Re: [PATCH V2] input:ad7879-i2c use swapped varient of i2c_smbus_read_word_data Date: Fri, 21 Oct 2011 09:09:23 -0700 Message-ID: <20111021160923.GA19153@core.coreip.homeip.net> References: <544AC56F16B56944AEC3BD4E3D59177146E75C18DC@LIMKCMBX1.ad.analog.com> <1319198236-2085-1-git-send-email-jic23@cam.ac.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from mail-pz0-f42.google.com ([209.85.210.42]:33805 "EHLO mail-pz0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752814Ab1JUQJd (ORCPT ); Fri, 21 Oct 2011 12:09:33 -0400 Received: by pzk36 with SMTP id 36so9903069pzk.1 for ; Fri, 21 Oct 2011 09:09:33 -0700 (PDT) Content-Disposition: inline In-Reply-To: <1319198236-2085-1-git-send-email-jic23@cam.ac.uk> Sender: linux-input-owner@vger.kernel.org List-Id: linux-input@vger.kernel.org To: Jonathan Cameron Cc: linux-input@vger.kernel.org, Michael.Hennerich@analog.com On Fri, Oct 21, 2011 at 12:57:16PM +0100, Jonathan Cameron wrote: > This varient was introduced in > i2c: boilerplate function for byte swapped smbus_write/read_word_data > > This also has the side effect of ensuring any errors from the i2c > read and no longer mangled. > > Signed-off-by: Jonathan Cameron > --- > V2: include the write function as pointed out by Michael Hennerich. > > The patch introducing this swapped function is working its way through the i2c > tree. > > drivers/input/touchscreen/ad7879-i2c.c | 4 ++-- > 1 files changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/input/touchscreen/ad7879-i2c.c b/drivers/input/touchscreen/ad7879-i2c.c > index 4e4e58c..cc51392 100644 > --- a/drivers/input/touchscreen/ad7879-i2c.c > +++ b/drivers/input/touchscreen/ad7879-i2c.c > @@ -47,7 +47,7 @@ static int ad7879_i2c_read(struct device *dev, u8 reg) > { > struct i2c_client *client = to_i2c_client(dev); > > - return swab16(i2c_smbus_read_word_data(client, reg)); > + return i2c_smbus_read_word_swapped(client, reg); This is still not endian-safe. I wonder if introducing i2c_smbus_read_word_swapped() just makes the metter worse by hiding this... I'd prefer if we had i2c_smbus_read_be16() instead. -- Dmitry