All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Jonathan Cameron <jic23@cam.ac.uk>
Cc: linux-input@vger.kernel.org, Michael.Hennerich@analog.com
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	[thread overview]
Message-ID: <20111021160923.GA19153@core.coreip.homeip.net> (raw)
In-Reply-To: <1319198236-2085-1-git-send-email-jic23@cam.ac.uk>

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 <jic23@cam.ac.uk>
> ---
> 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

  reply	other threads:[~2011-10-21 16:09 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-21 10:03 [PATCH] input:ad7879-i2c use swapped varient of i2c_smbus_read_word_data Jonathan Cameron
2011-10-21 10:40 ` Hennerich, Michael
2011-10-21 10:43   ` Hennerich, Michael
2011-10-21 11:57     ` [PATCH V2] " Jonathan Cameron
2011-10-21 16:09       ` Dmitry Torokhov [this message]
2011-10-21 16:14         ` Jonathan Cameron
2011-10-21 16:21           ` Dmitry Torokhov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20111021160923.GA19153@core.coreip.homeip.net \
    --to=dmitry.torokhov@gmail.com \
    --cc=Michael.Hennerich@analog.com \
    --cc=jic23@cam.ac.uk \
    --cc=linux-input@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.