staging: iio: tsl2x7x: cleaned up i2c calls in tsl2x7x_als_calibrate()
authorBrian Masney <masneyb@onstation.org>
Thu, 6 Jul 2017 22:56:22 +0000 (18:56 -0400)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Sun, 9 Jul 2017 17:28:47 +0000 (18:28 +0100)
commit1b4cbe2ef00e5d055bb310030ed3eac9bc1d3e3d
tree47fcb4e070a93c0df93cef0bff9fb2eaffec1cdd
parentd2f46f56b8ecd32ab0734b4a6d8a14de88d9894f
staging: iio: tsl2x7x: cleaned up i2c calls in tsl2x7x_als_calibrate()

The calibration function calls i2c_smbus_write_byte() and
i2c_smbus_read_byte(). These two function calls are replaced with a
single call to i2c_smbus_read_byte_data() by this patch. This patch
also removes an unnecessary call that reads the CNTRL register
a second time. One of the error paths returned -1 if the ADC was not
enabled and this patch changes that return value to -EINVAL.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/staging/iio/light/tsl2x7x.c