Commit 913b1d85 authored by Nicholas Mc Guire's avatar Nicholas Mc Guire Committed by Wolfram Sang

i2c: img-scb: fixup of wait_for_completion_timeout return handling

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: default avatarNicholas Mc Guire <hofrat@osadl.org>
Acked-by: default avatarJames Hogan <james.hogan@imgtec.com>
Signed-off-by: default avatarWolfram Sang <wsa@the-dreams.de>
parent 1c42aca5
...@@ -988,15 +988,16 @@ static irqreturn_t img_i2c_isr(int irq, void *dev_id) ...@@ -988,15 +988,16 @@ static irqreturn_t img_i2c_isr(int irq, void *dev_id)
static int img_i2c_reset_bus(struct img_i2c *i2c) static int img_i2c_reset_bus(struct img_i2c *i2c)
{ {
unsigned long flags; unsigned long flags;
int ret; unsigned long time_left;
spin_lock_irqsave(&i2c->lock, flags); spin_lock_irqsave(&i2c->lock, flags);
reinit_completion(&i2c->msg_complete); reinit_completion(&i2c->msg_complete);
img_i2c_reset_start(i2c); img_i2c_reset_start(i2c);
spin_unlock_irqrestore(&i2c->lock, flags); spin_unlock_irqrestore(&i2c->lock, flags);
ret = wait_for_completion_timeout(&i2c->msg_complete, IMG_I2C_TIMEOUT); time_left = wait_for_completion_timeout(&i2c->msg_complete,
if (ret == 0) IMG_I2C_TIMEOUT);
if (time_left == 0)
return -ETIMEDOUT; return -ETIMEDOUT;
return 0; return 0;
} }
...@@ -1007,6 +1008,7 @@ static int img_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, ...@@ -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); struct img_i2c *i2c = i2c_get_adapdata(adap);
bool atomic = false; bool atomic = false;
int i, ret; int i, ret;
unsigned long time_left;
if (i2c->mode == MODE_SUSPEND) { if (i2c->mode == MODE_SUSPEND) {
WARN(1, "refusing to service transaction in suspended state\n"); 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, ...@@ -1068,11 +1070,11 @@ static int img_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs,
img_i2c_write(i2c); img_i2c_write(i2c);
spin_unlock_irqrestore(&i2c->lock, flags); spin_unlock_irqrestore(&i2c->lock, flags);
ret = wait_for_completion_timeout(&i2c->msg_complete, time_left = wait_for_completion_timeout(&i2c->msg_complete,
IMG_I2C_TIMEOUT); IMG_I2C_TIMEOUT);
del_timer_sync(&i2c->check_timer); del_timer_sync(&i2c->check_timer);
if (ret == 0) { if (time_left == 0) {
dev_err(adap->dev.parent, "i2c transfer timed out\n"); dev_err(adap->dev.parent, "i2c transfer timed out\n");
i2c->msg_status = -ETIMEDOUT; i2c->msg_status = -ETIMEDOUT;
break; break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment