diff options
author | Brian Masney <masneyb@onstation.org> | 2016-11-03 13:56:17 +0100 |
---|---|---|
committer | Jonathan Cameron <jic23@kernel.org> | 2016-11-06 12:54:32 +0100 |
commit | c2b0d2cfb0317275cf04257fc3f5dfbdd9ffa274 (patch) | |
tree | c18aaf2286d725d2f66c2cc1fe877a05269eff89 | |
parent | staging: iio: tsl2583: don't shutdown chip when updating the lux table (diff) | |
download | linux-c2b0d2cfb0317275cf04257fc3f5dfbdd9ffa274.tar.xz linux-c2b0d2cfb0317275cf04257fc3f5dfbdd9ffa274.zip |
staging: iio: tsl2583: remove redudant i2c call in taos_als_calibrate()
taos_als_calibrate() queries the control register to determine if the
unit is powered on and has the ADC enabled. It then queries the same
register a second time to determine if the ADC reading is valid. This
patch removes the redundant i2c_smbus_read_byte_data() call.
Verified that the driver still functions correctly using a TSL2581
hooked up to a Raspberry Pi 2.
Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
-rw-r--r-- | drivers/staging/iio/light/tsl2583.c | 13 |
1 files changed, 1 insertions, 12 deletions
diff --git a/drivers/staging/iio/light/tsl2583.c b/drivers/staging/iio/light/tsl2583.c index af1cf9bdbd85..7eab17f4557e 100644 --- a/drivers/staging/iio/light/tsl2583.c +++ b/drivers/staging/iio/light/tsl2583.c @@ -338,18 +338,7 @@ static int taos_als_calibrate(struct iio_dev *indio_dev) dev_err(&chip->client->dev, "taos_als_calibrate failed: device not powered on with ADC enabled\n"); return -EINVAL; - } - - ret = i2c_smbus_read_byte_data(chip->client, - TSL258X_CMD_REG | TSL258X_CNTRL); - if (ret < 0) { - dev_err(&chip->client->dev, - "%s failed to read from the CNTRL register\n", - __func__); - return ret; - } - - if ((ret & TSL258X_STA_ADC_VALID) != TSL258X_STA_ADC_VALID) { + } else if ((ret & TSL258X_STA_ADC_VALID) != TSL258X_STA_ADC_VALID) { dev_err(&chip->client->dev, "taos_als_calibrate failed: STATUS - ADC not valid.\n"); return -ENODATA; |