summaryrefslogtreecommitdiff
path: root/include/linux/flex_array.h
diff options
context:
space:
mode:
authorBrian Masney <masneyb@onstation.org>2016-11-03 15:56:12 +0300
committerJonathan Cameron <jic23@kernel.org>2016-11-06 14:33:11 +0300
commit6ba5dee90b2483f8a78081376f56e6b65c10ea92 (patch)
tree1a96ab417c99b1e30d464ce80317f2de3767d1cb /include/linux/flex_array.h
parent25acb3986f3e14210f37eb5503beba8e35126a3e (diff)
downloadlinux-6ba5dee90b2483f8a78081376f56e6b65c10ea92.tar.xz
staging: iio: tsl2583: i2c_smbus_write_byte() / i2c_smbus_read_byte() migration
There were several places where the driver would first call i2c_smbus_write_byte() to select the register on the device, and then call i2c_smbus_read_byte() to get the contents of that register. The code would look roughly like: /* Select register */ i2c_smbus_write_byte(client, REGISTER); /* Read the the last register that was written to */ int data = i2c_smbus_read_byte(client); Rewrite this to use i2c_smbus_read_byte_data() to combine the two calls into one: int data = i2c_smbus_read_byte_data(chip->client, REGISTER); Verified that the driver still functions correctly using a TSL2581 hooked up to a Raspberry Pi 2. This fixes the following warnings that were found by the kbuild test robot that were introduced by commit 8ba355cce3c6 ("staging: iio: tsl2583: check for error code from i2c_smbus_read_byte()"). drivers/staging/iio/light/tsl2583.c:365:5-12: WARNING: Unsigned expression compared with zero: reg_val < 0 drivers/staging/iio/light/tsl2583.c:388:5-12: WARNING: Unsigned expression compared with zero: reg_val < 0 This also removes the need for the taos_i2c_read() function since all callers were only calling the function with a length of 1. Signed-off-by: Brian Masney <masneyb@onstation.org> Cc: Julia Lawall <julia.lawall@lip6.fr> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'include/linux/flex_array.h')
0 files changed, 0 insertions, 0 deletions