From: Lars-Peter Clausen <lars@metafoo.de>
To: Jonathan Cameron <jic23@kernel.org>,
Hartmut Knaack <knaack.h@gmx.de>,
Peter Meerwald <pmeerw@pmeerw.net>
Cc: Marc Andre <marc.andre@netline.ch>,
linux-iio@vger.kernel.org,
Michael Hennerich <michael.hennerich@analog.com>
Subject: Re: [PATCH 1/2] iio:ad5064: Make sure ad5064_i2c_write() returns 0 on success
Date: Tue, 13 Oct 2015 18:23:36 +0200 [thread overview]
Message-ID: <561D3008.2010902@metafoo.de> (raw)
In-Reply-To: <1444752938-4680-1-git-send-email-lars@metafoo.de>
On 10/13/2015 06:15 PM, Lars-Peter Clausen wrote:
> From: Michael Hennerich <michael.hennerich@analog.com>
>
> i2c_master_send() returns the number of bytes transferred on success while
> the ad5064 driver expects that the write() callback returns 0 on success.
> Fix that by translating any non negative return value of i2c_master_send()
> to 0.
>
> Fixes: commit 6a17a0768f77 ("iio:dac:ad5064: Add support for the ad5629r and ad5669r")
> Signed-off-by: Michael Hennerich <michael.hennerich@analog.com>
And obviously
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Sorry for that.
> ---
> drivers/iio/dac/ad5064.c | 8 +++++++-
> 1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/iio/dac/ad5064.c b/drivers/iio/dac/ad5064.c
> index c067e68..7e7ebf3 100644
> --- a/drivers/iio/dac/ad5064.c
> +++ b/drivers/iio/dac/ad5064.c
> @@ -598,10 +598,16 @@ static int ad5064_i2c_write(struct ad5064_state *st, unsigned int cmd,
> unsigned int addr, unsigned int val)
> {
> struct i2c_client *i2c = to_i2c_client(st->dev);
> + int ret;
>
> st->data.i2c[0] = (cmd << 4) | addr;
> put_unaligned_be16(val, &st->data.i2c[1]);
> - return i2c_master_send(i2c, st->data.i2c, 3);
> +
> + ret = i2c_master_send(i2c, st->data.i2c, 3);
> + if (ret < 0)
> + return ret;
> +
> + return 0;
> }
>
> static int ad5064_i2c_probe(struct i2c_client *i2c,
>
next prev parent reply other threads:[~2015-10-13 16:26 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-13 16:15 [PATCH 1/2] iio:ad5064: Make sure ad5064_i2c_write() returns 0 on success Lars-Peter Clausen
2015-10-13 16:15 ` [PATCH 2/2] iio: ad5064: Fix ad5629/ad5669 shift Lars-Peter Clausen
2015-10-25 12:31 ` Jonathan Cameron
2015-10-13 16:23 ` Lars-Peter Clausen [this message]
2015-10-25 12:31 ` [PATCH 1/2] iio:ad5064: Make sure ad5064_i2c_write() returns 0 on success Jonathan Cameron
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=561D3008.2010902@metafoo.de \
--to=lars@metafoo.de \
--cc=jic23@kernel.org \
--cc=knaack.h@gmx.de \
--cc=linux-iio@vger.kernel.org \
--cc=marc.andre@netline.ch \
--cc=michael.hennerich@analog.com \
--cc=pmeerw@pmeerw.net \
/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.