diff options
| author | Brian Masney <[email protected]> | 2016-11-03 08:56:12 -0400 |
|---|---|---|
| committer | Jonathan Cameron <[email protected]> | 2016-11-06 11:33:11 +0000 |
| commit | 6ba5dee90b2483f8a78081376f56e6b65c10ea92 (patch) | |
| tree | 1a96ab417c99b1e30d464ce80317f2de3767d1cb /tools/perf/scripts/python/bin/stackcollapse-record | |
| parent | 25acb3986f3e14210f37eb5503beba8e35126a3e (diff) | |
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 <[email protected]>
Cc: Julia Lawall <[email protected]>
Signed-off-by: Jonathan Cameron <[email protected]>
Diffstat (limited to 'tools/perf/scripts/python/bin/stackcollapse-record')
0 files changed, 0 insertions, 0 deletions