From: James Hogan <james.hogan-1AXoQHu6uovQT0dZR+AlfA@public.gmane.org>
To: Nicholas Mc Guire
<hofrat-Q945KHDl0DbYtjvyW6yDsg@public.gmane.org>,
Wolfram Sang <wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org>
Cc: Ezequiel Garcia
<ezequiel.garcia-1AXoQHu6uovQT0dZR+AlfA@public.gmane.org>,
Andrew Bresticker
<abrestic-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>,
linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH v2] i2c: img-scb: fixup of wait_for_completion_timeout return handling
Date: Mon, 9 Feb 2015 15:25:08 +0000 [thread overview]
Message-ID: <54D8D154.4070402@imgtec.com> (raw)
In-Reply-To: <1423494921-2708-1-git-send-email-hofrat-Q945KHDl0DbYtjvyW6yDsg@public.gmane.org>
[-- Attachment #1: Type: text/plain, Size: 2573 bytes --]
On 09/02/15 15:15, Nicholas Mc Guire wrote:
> Return type of wait_for_completion_timeout is unsigned long not int.
> Appropriately typed/named variable are added and assignment fixed up.
>
> Signed-off-by: Nicholas Mc Guire <hofrat-Q945KHDl0DbYtjvyW6yDsg@public.gmane.org>
v2 also:
Acked-by: James Hogan <james.hogan-1AXoQHu6uovQT0dZR+AlfA@public.gmane.org>
Thanks
James
> ---
>
> v2: int ret is an idiom - thus rather than just changing the type, rename
> the variable, as suggested by Wolfram Sang <wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org>.
>
> Patch was compile tested with x86_64_defconfig + CONFIG_COMPILE_TEST=y
> CONFIG_I2C_IMG=m
>
> Patch is against 3.19.0-rc7 (localversion-next is -next-20150209)
>
> drivers/i2c/busses/i2c-img-scb.c | 14 ++++++++------
> 1 file changed, 8 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/i2c/busses/i2c-img-scb.c b/drivers/i2c/busses/i2c-img-scb.c
> index 0fcc169..6e4e990 100644
> --- a/drivers/i2c/busses/i2c-img-scb.c
> +++ b/drivers/i2c/busses/i2c-img-scb.c
> @@ -988,15 +988,16 @@ out:
> static int img_i2c_reset_bus(struct img_i2c *i2c)
> {
> unsigned long flags;
> - int ret;
> + unsigned long timeout;
>
> spin_lock_irqsave(&i2c->lock, flags);
> reinit_completion(&i2c->msg_complete);
> img_i2c_reset_start(i2c);
> spin_unlock_irqrestore(&i2c->lock, flags);
>
> - ret = wait_for_completion_timeout(&i2c->msg_complete, IMG_I2C_TIMEOUT);
> - if (ret == 0)
> + timeout = wait_for_completion_timeout(&i2c->msg_complete,
> + IMG_I2C_TIMEOUT);
> + if (timeout == 0)
> return -ETIMEDOUT;
> return 0;
> }
> @@ -1007,6 +1008,7 @@ static int img_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs,
> struct img_i2c *i2c = i2c_get_adapdata(adap);
> bool atomic = false;
> int i, ret;
> + unsigned long timeout;
>
> if (i2c->mode == MODE_SUSPEND) {
> WARN(1, "refusing to service transaction in suspended state\n");
> @@ -1068,11 +1070,11 @@ static int img_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs,
> img_i2c_write(i2c);
> spin_unlock_irqrestore(&i2c->lock, flags);
>
> - ret = wait_for_completion_timeout(&i2c->msg_complete,
> - IMG_I2C_TIMEOUT);
> + timeout = wait_for_completion_timeout(&i2c->msg_complete,
> + IMG_I2C_TIMEOUT);
> del_timer_sync(&i2c->check_timer);
>
> - if (ret == 0) {
> + if (timeout == 0) {
> dev_err(adap->dev.parent, "i2c transfer timed out\n");
> i2c->msg_status = -ETIMEDOUT;
> break;
>
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
next prev parent reply other threads:[~2015-02-09 15:25 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-09 15:15 [PATCH v2] i2c: img-scb: fixup of wait_for_completion_timeout return handling Nicholas Mc Guire
[not found] ` <1423494921-2708-1-git-send-email-hofrat-Q945KHDl0DbYtjvyW6yDsg@public.gmane.org>
2015-02-09 15:25 ` James Hogan [this message]
2015-03-15 10:01 ` Wolfram Sang
2015-03-15 10:12 ` Nicholas Mc Guire
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=54D8D154.4070402@imgtec.com \
--to=james.hogan-1axoqhu6uovqt0dzr+alfa@public.gmane.org \
--cc=abrestic-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org \
--cc=ezequiel.garcia-1AXoQHu6uovQT0dZR+AlfA@public.gmane.org \
--cc=hofrat-Q945KHDl0DbYtjvyW6yDsg@public.gmane.org \
--cc=linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.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.