The return value of wait_for_completion_timeout() is always
>= 0 with unsigned int type.
So the condition "ret < 0" or "ret >= 0" is pointless.
Signed-off-by: liu chuansheng <[email protected]>
---
drivers/i2c/busses/i2c-nomadik.c | 14 --------------
1 files changed, 0 insertions(+), 14 deletions(-)
diff --git a/drivers/i2c/busses/i2c-nomadik.c b/drivers/i2c/busses/i2c-nomadik.c
index 02c3115..8b2ffcf 100644
--- a/drivers/i2c/busses/i2c-nomadik.c
+++ b/drivers/i2c/busses/i2c-nomadik.c
@@ -435,13 +435,6 @@ static int read_i2c(struct nmk_i2c_dev *dev, u16 flags)
timeout = wait_for_completion_timeout(
&dev->xfer_complete, dev->adap.timeout);
- if (timeout < 0) {
- dev_err(&dev->adev->dev,
- "wait_for_completion_timeout "
- "returned %d waiting for event\n", timeout);
- status = timeout;
- }
-
if (timeout == 0) {
/* Controller timed out */
dev_err(&dev->adev->dev, "read from slave 0x%x timed out\n",
@@ -523,13 +516,6 @@ static int write_i2c(struct nmk_i2c_dev *dev, u16 flags)
timeout = wait_for_completion_timeout(
&dev->xfer_complete, dev->adap.timeout);
- if (timeout < 0) {
- dev_err(&dev->adev->dev,
- "wait_for_completion_timeout "
- "returned %d waiting for event\n", timeout);
- status = timeout;
- }
-
if (timeout == 0) {
/* Controller timed out */
dev_err(&dev->adev->dev, "write to slave 0x%x timed out\n",
--
1.7.0.4
The return value of wait_for_completion_timeout() is always
>= 0 with unsigned int type.
So the condition "ret < 0" or "ret >= 0" is pointless.
Signed-off-by: liu chuansheng <[email protected]>
---
drivers/video/omap2/dss/dispc.c | 3 ---
1 files changed, 0 insertions(+), 3 deletions(-)
diff --git a/drivers/video/omap2/dss/dispc.c b/drivers/video/omap2/dss/dispc.c
index b43477a..9858869 100644
--- a/drivers/video/omap2/dss/dispc.c
+++ b/drivers/video/omap2/dss/dispc.c
@@ -3893,9 +3893,6 @@ int omap_dispc_wait_for_irq_timeout(u32 irqmask, unsigned long timeout)
if (timeout == 0)
return -ETIMEDOUT;
- if (timeout == -ERESTARTSYS)
- return -ERESTARTSYS;
-
return 0;
}
--
1.7.0.4
The return value of wait_for_completion_timeout() is always
>= 0 with unsigned int type.
So the condition "ret < 0" or "ret >= 0" is pointless.
Signed-off-by: liu chuansheng <[email protected]>
---
drivers/video/omap2/dss/apply.c | 2 --
1 files changed, 0 insertions(+), 2 deletions(-)
diff --git a/drivers/video/omap2/dss/apply.c b/drivers/video/omap2/dss/apply.c
index 19d66f4..ec42a6a 100644
--- a/drivers/video/omap2/dss/apply.c
+++ b/drivers/video/omap2/dss/apply.c
@@ -414,8 +414,6 @@ static void wait_pending_extra_info_updates(void)
r = wait_for_completion_timeout(&extra_updated_completion, t);
if (r == 0)
DSSWARN("timeout in wait_pending_extra_info_updates\n");
- else if (r < 0)
- DSSERR("wait_pending_extra_info_updates failed: %d\n", r);
}
int dss_mgr_wait_for_go(struct omap_overlay_manager *mgr)
--
1.7.0.4
The return value of wait_for_completion_timeout() is always
>= 0 with unsigned int type.
So the condition "ret < 0" or "ret >= 0" is pointless.
Signed-off-by: liu chuansheng <[email protected]>
---
drivers/net/wireless/ti/wlcore/ps.c | 3 ---
1 files changed, 0 insertions(+), 3 deletions(-)
diff --git a/drivers/net/wireless/ti/wlcore/ps.c b/drivers/net/wireless/ti/wlcore/ps.c
index 4d1414a..ffcd843 100644
--- a/drivers/net/wireless/ti/wlcore/ps.c
+++ b/drivers/net/wireless/ti/wlcore/ps.c
@@ -151,9 +151,6 @@ int wl1271_ps_elp_wakeup(struct wl1271 *wl)
wl12xx_queue_recovery_work(wl);
ret = -ETIMEDOUT;
goto err;
- } else if (ret < 0) {
- wl1271_error("ELP wakeup completion error.");
- goto err;
}
}
--
1.7.0.4
The return value of wait_for_completion_timeout() is always
>= 0 with unsigned int type.
So the condition "ret < 0" or "ret >= 0" is pointless.
Signed-off-by: liu chuansheng <[email protected]>
---
drivers/net/can/janz-ican3.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/can/janz-ican3.c b/drivers/net/can/janz-ican3.c
index 7edadee..c0bfb0a 100644
--- a/drivers/net/can/janz-ican3.c
+++ b/drivers/net/can/janz-ican3.c
@@ -1692,7 +1692,7 @@ static int ican3_get_berr_counter(const struct net_device *ndev,
return ret;
ret = wait_for_completion_timeout(&mod->buserror_comp, HZ);
- if (ret <= 0) {
+ if (ret == 0) {
dev_info(mod->dev, "%s timed out\n", __func__);
return -ETIMEDOUT;
}
@@ -1718,7 +1718,7 @@ static ssize_t ican3_sysfs_show_term(struct device *dev,
return ret;
ret = wait_for_completion_timeout(&mod->termination_comp, HZ);
- if (ret <= 0) {
+ if (ret == 0) {
dev_info(mod->dev, "%s timed out\n", __func__);
return -ETIMEDOUT;
}
--
1.7.0.4
The return value of wait_for_completion_timeout() is always
>= 0 with unsigned int type.
So the condition "ret < 0" or "ret >= 0" is pointless.
Signed-off-by: liu chuansheng <[email protected]>
---
drivers/video/mx3fb.c | 7 +++----
1 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/drivers/video/mx3fb.c b/drivers/video/mx3fb.c
index ce1d452..88bf368 100644
--- a/drivers/video/mx3fb.c
+++ b/drivers/video/mx3fb.c
@@ -1110,12 +1110,11 @@ static int mx3fb_pan_display(struct fb_var_screeninfo *var,
enable_irq(mx3_fbi->idmac_channel->eof_irq);
ret = wait_for_completion_timeout(&mx3_fbi->flip_cmpl, HZ / 10);
- if (ret <= 0) {
+ if (ret == 0) {
mutex_unlock(&mx3_fbi->mutex);
- dev_info(fbi->device, "Panning failed due to %s\n", ret < 0 ?
- "user interrupt" : "timeout");
+ dev_info(fbi->device, "Panning failed due to timeout\n");
disable_irq(mx3_fbi->idmac_channel->eof_irq);
- return ret ? : -ETIMEDOUT;
+ return -ETIMEDOUT;
}
mx3_fbi->cur_ipu_buf = !mx3_fbi->cur_ipu_buf;
--
1.7.0.4
The return value of wait_for_completion_timeout() is always
>= 0 with unsigned int type.
So the condition "ret < 0" or "ret >= 0" is pointless.
Signed-off-by: liu chuansheng <[email protected]>
---
drivers/infiniband/ulp/srpt/ib_srpt.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp/srpt/ib_srpt.c
index cf23c46..1879b47 100644
--- a/drivers/infiniband/ulp/srpt/ib_srpt.c
+++ b/drivers/infiniband/ulp/srpt/ib_srpt.c
@@ -3527,7 +3527,7 @@ static void srpt_close_session(struct se_session *se_sess)
spin_unlock_irq(&sdev->spinlock);
res = wait_for_completion_timeout(&release_done, 60 * HZ);
- WARN_ON(res <= 0);
+ WARN_ON(res == 0);
}
/**
--
1.7.0.4
On 2012-11-06 19:21, Chuansheng Liu wrote:
>
> The return value of wait_for_completion_timeout() is always
>> = 0 with unsigned int type.
>
> So the condition "ret < 0" or "ret >= 0" is pointless.
>
> Signed-off-by: liu chuansheng <[email protected]>
> ---
> drivers/video/omap2/dss/dispc.c | 3 ---
> 1 files changed, 0 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/video/omap2/dss/dispc.c b/drivers/video/omap2/dss/dispc.c
> index b43477a..9858869 100644
> --- a/drivers/video/omap2/dss/dispc.c
> +++ b/drivers/video/omap2/dss/dispc.c
> @@ -3893,9 +3893,6 @@ int omap_dispc_wait_for_irq_timeout(u32 irqmask, unsigned long timeout)
> if (timeout == 0)
> return -ETIMEDOUT;
>
> - if (timeout == -ERESTARTSYS)
> - return -ERESTARTSYS;
> -
> return 0;
> }
Thanks. I'll apply this to omapdss tree to avoid any conflicts.
Tomi
On 2012-11-06 19:22, Chuansheng Liu wrote:
>
> The return value of wait_for_completion_timeout() is always
>> = 0 with unsigned int type.
>
> So the condition "ret < 0" or "ret >= 0" is pointless.
>
> Signed-off-by: liu chuansheng <[email protected]>
> ---
> drivers/video/omap2/dss/apply.c | 2 --
> 1 files changed, 0 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/video/omap2/dss/apply.c b/drivers/video/omap2/dss/apply.c
> index 19d66f4..ec42a6a 100644
> --- a/drivers/video/omap2/dss/apply.c
> +++ b/drivers/video/omap2/dss/apply.c
> @@ -414,8 +414,6 @@ static void wait_pending_extra_info_updates(void)
> r = wait_for_completion_timeout(&extra_updated_completion, t);
> if (r == 0)
> DSSWARN("timeout in wait_pending_extra_info_updates\n");
> - else if (r < 0)
> - DSSERR("wait_pending_extra_info_updates failed: %d\n", r);
> }
>
> int dss_mgr_wait_for_go(struct omap_overlay_manager *mgr)
Thanks. I'll apply this to omapdss tree to avoid any conflicts.
Tomi
On 11/06/2012 06:31 PM, Chuansheng Liu wrote:
>
> The return value of wait_for_completion_timeout() is always
>> = 0 with unsigned int type.
>
> So the condition "ret < 0" or "ret >= 0" is pointless.
>
> Signed-off-by: liu chuansheng <[email protected]>
Thnx, applied to can-next. Please put [email protected] on Cc
next time.
regards, Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Industrial Linux Solutions | Phone: +49-231-2826-924 |
Vertretung West/Dortmund | Fax: +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de |
On Wed, Nov 07, 2012 at 01:18:37AM +0800, Chuansheng Liu wrote:
>
> The return value of wait_for_completion_timeout() is always
> >= 0 with unsigned int type.
>
> So the condition "ret < 0" or "ret >= 0" is pointless.
>
> Signed-off-by: liu chuansheng <[email protected]>
You forgot to add the i2c-list, so I nearly overlooked this patch.
Luckily I haven't, so applied to for-next, thanks! Did you use a script
to find all occurences? Would be nice to know. Also, please take care of
the subject line. "I2c" is misspelled.
@Linus: I am not pushing out today, so if you want to add acks or so...
Thanks,
Wolfram
> ---
> drivers/i2c/busses/i2c-nomadik.c | 14 --------------
> 1 files changed, 0 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/i2c/busses/i2c-nomadik.c b/drivers/i2c/busses/i2c-nomadik.c
> index 02c3115..8b2ffcf 100644
> --- a/drivers/i2c/busses/i2c-nomadik.c
> +++ b/drivers/i2c/busses/i2c-nomadik.c
> @@ -435,13 +435,6 @@ static int read_i2c(struct nmk_i2c_dev *dev, u16 flags)
> timeout = wait_for_completion_timeout(
> &dev->xfer_complete, dev->adap.timeout);
>
> - if (timeout < 0) {
> - dev_err(&dev->adev->dev,
> - "wait_for_completion_timeout "
> - "returned %d waiting for event\n", timeout);
> - status = timeout;
> - }
> -
> if (timeout == 0) {
> /* Controller timed out */
> dev_err(&dev->adev->dev, "read from slave 0x%x timed out\n",
> @@ -523,13 +516,6 @@ static int write_i2c(struct nmk_i2c_dev *dev, u16 flags)
> timeout = wait_for_completion_timeout(
> &dev->xfer_complete, dev->adap.timeout);
>
> - if (timeout < 0) {
> - dev_err(&dev->adev->dev,
> - "wait_for_completion_timeout "
> - "returned %d waiting for event\n", timeout);
> - status = timeout;
> - }
> -
> if (timeout == 0) {
> /* Controller timed out */
> dev_err(&dev->adev->dev, "write to slave 0x%x timed out\n",
> --
> 1.7.0.4
>
>
>
--
Pengutronix e.K. | Wolfram Sang |
Industrial Linux Solutions | http://www.pengutronix.de/ |
> -----Original Message-----
> From: Wolfram Sang [mailto:[email protected]]
> Sent: Tuesday, November 13, 2012 1:27 AM
> To: Liu, Chuansheng
> Cc: [email protected]; [email protected];
> [email protected]; [email protected]
> Subject: Re: [PATCH 1/7] I2c-nomadik: Fix the usage of
> wait_for_completion_timeout
>
> On Wed, Nov 07, 2012 at 01:18:37AM +0800, Chuansheng Liu wrote:
> >
> > The return value of wait_for_completion_timeout() is always
> > >= 0 with unsigned int type.
> >
> > So the condition "ret < 0" or "ret >= 0" is pointless.
> >
> > Signed-off-by: liu chuansheng <[email protected]>
>
> You forgot to add the i2c-list, so I nearly overlooked this patch.
> Luckily I haven't, so applied to for-next, thanks! Did you use a script
> to find all occurences? Would be nice to know. Also, please take care of
> the subject line. "I2c" is misspelled.
Thanks your pointing out. I just manually reviewed the code when found this point.
Would like to try some auto-script but failed:)
> Thanks your pointing out. I just manually reviewed the code when found
> this point. Would like to try some auto-script but failed:)
I can suggest 'coccinelle' for that kind of job.
--
Pengutronix e.K. | Wolfram Sang |
Industrial Linux Solutions | http://www.pengutronix.de/ |
> -----Original Message-----
> From: Wolfram Sang [mailto:[email protected]]
> Sent: Tuesday, November 13, 2012 3:58 PM
> To: Liu, Chuansheng
> Cc: [email protected]; [email protected];
> [email protected]; [email protected]
> Subject: Re: [PATCH 1/7] I2c-nomadik: Fix the usage of
> wait_for_completion_timeout
>
>
> > Thanks your pointing out. I just manually reviewed the code when found
> > this point. Would like to try some auto-script but failed:)
>
> I can suggest 'coccinelle' for that kind of job.
Thanks, let me try, if possible anyone can give some help?
>
> --
> Pengutronix e.K. | Wolfram Sang
> |
> Industrial Linux Solutions | http://www.pengutronix.de/
> |
On Wed, 2012-11-07 at 01:28 +0800, Chuansheng Liu wrote:
> The return value of wait_for_completion_timeout() is always
> >= 0 with unsigned int type.
>
> So the condition "ret < 0" or "ret >= 0" is pointless.
>
> Signed-off-by: liu chuansheng <[email protected]>
> ---
Applied and pushed via wl12xx.git.
Thank you!
--
Luca.