summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShridhar Rasal <srasal@nvidia.com>2012-06-15 14:43:33 +0530
committerLokesh Pathak <lpathak@nvidia.com>2012-06-18 08:22:48 -0700
commit97d9070b427f98596224fe876149027ed15e8eed (patch)
tree9bf3654ae382996ed72fab9f114bcb739653ac7c
parent3deb1f094fa06f10fb905d71ac5c8425fb0a6c21 (diff)
iio: light: fix error handling for LTR558
Change-Id: I34748241728bb0bab1861f8abacffdfe2939740f Signed-off-by: Shridhar Rasal <srasal@nvidia.com> Reviewed-on: http://git-master/r/109158 Reviewed-by: Sachin Nikam <snikam@nvidia.com> Reviewed-by: Automatic_Commit_Validation_User
-rw-r--r--drivers/staging/iio/light/ltr558als.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/drivers/staging/iio/light/ltr558als.c b/drivers/staging/iio/light/ltr558als.c
index 01e410b191fd..4fef5d4cc034 100644
--- a/drivers/staging/iio/light/ltr558als.c
+++ b/drivers/staging/iio/light/ltr558als.c
@@ -193,7 +193,7 @@ static bool ltr558_set_proxim_high_threshold(struct i2c_client *client,
bool st;
st = ltr558_i2c_write_reg(client, LTR558_PS_THRES_UP_0,
thresh & 0xFF);
- if (st)
+ if (!st)
st = ltr558_i2c_write_reg(client, LTR558_PS_THRES_UP_1,
(thresh >> 8) & 0x07);
return st;
@@ -205,7 +205,7 @@ static bool ltr558_set_proxim_low_threshold(struct i2c_client *client,
bool st;
st = ltr558_i2c_write_reg(client, LTR558_PS_THRES_LOW_0,
thresh & 0xFF);
- if (st)
+ if (!st)
st = ltr558_i2c_write_reg(client, LTR558_PS_THRES_LOW_1,
(thresh >> 8) & 0x07);
return st;
@@ -216,7 +216,7 @@ static bool ltr558_set_als_high_threshold(struct i2c_client *client, u32 thresh)
bool st;
st = ltr558_i2c_write_reg(client, LTR558_ALS_THRES_UP_0,
thresh & 0xFF);
- if (st)
+ if (!st)
st = ltr558_i2c_write_reg(client, LTR558_ALS_THRES_UP_1,
(thresh >> 8) & 0xFF);
return st;
@@ -227,7 +227,7 @@ static bool ltr558_set_als_low_threshold(struct i2c_client *client, u32 thresh)
bool st;
st = ltr558_i2c_write_reg(client, LTR558_ALS_THRES_LOW_0,
thresh & 0xFF);
- if (st)
+ if (!st)
st = ltr558_i2c_write_reg(client, LTR558_ALS_THRES_LOW_1,
((thresh >> 8) & 0xFF));
return st;
@@ -314,7 +314,7 @@ static ssize_t store_proxim_low_threshold(struct device *dev,
mutex_lock(&chip->lock);
st = ltr558_set_proxim_low_threshold(client, (u8)lval);
- if (st)
+ if (!st)
chip->prox_low_thres = (int)lval;
else
dev_err(dev, "Error in setting proximity low threshold\n");
@@ -355,7 +355,7 @@ static ssize_t store_proxim_high_threshold(struct device *dev,
mutex_lock(&chip->lock);
st = ltr558_set_proxim_high_threshold(client, lval);
- if (st)
+ if (!st)
chip->prox_high_thres = (int)lval;
else
dev_err(dev, "Error in setting proximity high threshold\n");
@@ -443,7 +443,7 @@ static ssize_t store_als_low_threshold(struct device *dev,
mutex_lock(&chip->lock);
st = ltr558_set_als_low_threshold(client, (int)lval);
- if (st)
+ if (!st)
chip->als_low_thres = (int)lval;
else
dev_err(dev, "Error in setting als low threshold\n");
@@ -483,7 +483,7 @@ static ssize_t store_als_high_threshold(struct device *dev,
mutex_lock(&chip->lock);
st = ltr558_set_als_high_threshold(client, (int)lval);
- if (st)
+ if (!st)
chip->als_high_thres = (int)lval;
else
dev_err(dev, "Error in setting als high threshold\n");