* [PATCH] i2c: img-scb: match return type of wait_for_completion_timeout
@ 2015-02-08 13:12 Nicholas Mc Guire
[not found] ` <1423401155-8955-1-git-send-email-hofrat-Q945KHDl0DbYtjvyW6yDsg@public.gmane.org>
0 siblings, 1 reply; 4+ messages in thread
From: Nicholas Mc Guire @ 2015-02-08 13:12 UTC (permalink / raw)
To: Wolfram Sang
Cc: James Hogan, Ezequiel Garcia, Andrew Bresticker,
linux-i2c-u79uwXL29TY76Z2rM5mHXA, Nicholas Mc Guire
Return type of wait_for_completion_timeout is unsigned long not int. ret in
img_i2c_reset_bus() was exclusively used for wait_for_completion_timeout so
its type is simply adjusted. In img_i2c_xfer an appropriately typed variable
is added and assignment fixed up.
Signed-off-by: Nicholas Mc Guire <hofrat-Q945KHDl0DbYtjvyW6yDsg@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-20150204)
drivers/i2c/busses/i2c-img-scb.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/drivers/i2c/busses/i2c-img-scb.c b/drivers/i2c/busses/i2c-img-scb.c
index 0fcc169..4f3a153 100644
--- a/drivers/i2c/busses/i2c-img-scb.c
+++ b/drivers/i2c/busses/i2c-img-scb.c
@@ -988,7 +988,7 @@ out:
static int img_i2c_reset_bus(struct img_i2c *i2c)
{
unsigned long flags;
- int ret;
+ unsigned long ret;
spin_lock_irqsave(&i2c->lock, flags);
reinit_completion(&i2c->msg_complete);
@@ -1007,6 +1007,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 +1069,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;
--
1.7.10.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] i2c: img-scb: match return type of wait_for_completion_timeout
[not found] ` <1423401155-8955-1-git-send-email-hofrat-Q945KHDl0DbYtjvyW6yDsg@public.gmane.org>
@ 2015-02-09 10:53 ` James Hogan
2015-02-09 13:22 ` Wolfram Sang
1 sibling, 0 replies; 4+ messages in thread
From: James Hogan @ 2015-02-09 10:53 UTC (permalink / raw)
To: Nicholas Mc Guire, Wolfram Sang
Cc: Ezequiel Garcia, Andrew Bresticker,
linux-i2c-u79uwXL29TY76Z2rM5mHXA
[-- Attachment #1: Type: text/plain, Size: 2181 bytes --]
On 08/02/15 13:12, Nicholas Mc Guire wrote:
> Return type of wait_for_completion_timeout is unsigned long not int. ret in
> img_i2c_reset_bus() was exclusively used for wait_for_completion_timeout so
> its type is simply adjusted. In img_i2c_xfer an appropriately typed variable
> is added and assignment fixed up.
>
> Signed-off-by: Nicholas Mc Guire <hofrat-Q945KHDl0DbYtjvyW6yDsg@public.gmane.org>
Looks good to me,
Acked-by: James Hogan <james.hogan-1AXoQHu6uovQT0dZR+AlfA@public.gmane.org>
Thanks
James
> ---
>
> 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-20150204)
>
> drivers/i2c/busses/i2c-img-scb.c | 9 +++++----
> 1 file changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/i2c/busses/i2c-img-scb.c b/drivers/i2c/busses/i2c-img-scb.c
> index 0fcc169..4f3a153 100644
> --- a/drivers/i2c/busses/i2c-img-scb.c
> +++ b/drivers/i2c/busses/i2c-img-scb.c
> @@ -988,7 +988,7 @@ out:
> static int img_i2c_reset_bus(struct img_i2c *i2c)
> {
> unsigned long flags;
> - int ret;
> + unsigned long ret;
>
> spin_lock_irqsave(&i2c->lock, flags);
> reinit_completion(&i2c->msg_complete);
> @@ -1007,6 +1007,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 +1069,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 --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] i2c: img-scb: match return type of wait_for_completion_timeout
[not found] ` <1423401155-8955-1-git-send-email-hofrat-Q945KHDl0DbYtjvyW6yDsg@public.gmane.org>
2015-02-09 10:53 ` James Hogan
@ 2015-02-09 13:22 ` Wolfram Sang
2015-02-09 14:57 ` Nicholas Mc Guire
1 sibling, 1 reply; 4+ messages in thread
From: Wolfram Sang @ 2015-02-09 13:22 UTC (permalink / raw)
To: Nicholas Mc Guire
Cc: James Hogan, Ezequiel Garcia, Andrew Bresticker,
linux-i2c-u79uwXL29TY76Z2rM5mHXA
[-- Attachment #1: Type: text/plain, Size: 2211 bytes --]
On Sun, Feb 08, 2015 at 08:12:35AM -0500, Nicholas Mc Guire wrote:
> Return type of wait_for_completion_timeout is unsigned long not int. ret in
> img_i2c_reset_bus() was exclusively used for wait_for_completion_timeout so
> its type is simply adjusted. In img_i2c_xfer an appropriately typed variable
> is added and assignment fixed up.
>
> Signed-off-by: Nicholas Mc Guire <hofrat-Q945KHDl0DbYtjvyW6yDsg@public.gmane.org>
Same as for the axxia driver: Please rename the variable because ret
being an int is kind of an idiom.
> ---
>
> 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-20150204)
>
> drivers/i2c/busses/i2c-img-scb.c | 9 +++++----
> 1 file changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/i2c/busses/i2c-img-scb.c b/drivers/i2c/busses/i2c-img-scb.c
> index 0fcc169..4f3a153 100644
> --- a/drivers/i2c/busses/i2c-img-scb.c
> +++ b/drivers/i2c/busses/i2c-img-scb.c
> @@ -988,7 +988,7 @@ out:
> static int img_i2c_reset_bus(struct img_i2c *i2c)
> {
> unsigned long flags;
> - int ret;
> + unsigned long ret;
>
> spin_lock_irqsave(&i2c->lock, flags);
> reinit_completion(&i2c->msg_complete);
> @@ -1007,6 +1007,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 +1069,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;
> --
> 1.7.10.4
>
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] i2c: img-scb: match return type of wait_for_completion_timeout
2015-02-09 13:22 ` Wolfram Sang
@ 2015-02-09 14:57 ` Nicholas Mc Guire
0 siblings, 0 replies; 4+ messages in thread
From: Nicholas Mc Guire @ 2015-02-09 14:57 UTC (permalink / raw)
To: Wolfram Sang
Cc: Nicholas Mc Guire, James Hogan, Ezequiel Garcia,
Andrew Bresticker, linux-i2c-u79uwXL29TY76Z2rM5mHXA
On Mon, 09 Feb 2015, Wolfram Sang wrote:
> On Sun, Feb 08, 2015 at 08:12:35AM -0500, Nicholas Mc Guire wrote:
> > Return type of wait_for_completion_timeout is unsigned long not int. ret in
> > img_i2c_reset_bus() was exclusively used for wait_for_completion_timeout so
> > its type is simply adjusted. In img_i2c_xfer an appropriately typed variable
> > is added and assignment fixed up.
> >
> > Signed-off-by: Nicholas Mc Guire <hofrat-Q945KHDl0DbYtjvyW6yDsg@public.gmane.org>
>
> Same as for the axxia driver: Please rename the variable because ret
> being an int is kind of an idiom.
>
added "don't break idioms" to my list of Checks - maybe something like this
even should be in SubmittingPatches ?
will fix up and resend.
thx!
hofrat
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-02-09 14:57 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-08 13:12 [PATCH] i2c: img-scb: match return type of wait_for_completion_timeout Nicholas Mc Guire
[not found] ` <1423401155-8955-1-git-send-email-hofrat-Q945KHDl0DbYtjvyW6yDsg@public.gmane.org>
2015-02-09 10:53 ` James Hogan
2015-02-09 13:22 ` Wolfram Sang
2015-02-09 14:57 ` Nicholas Mc Guire
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).