iio:st_sensors: emulate SMBus block read if needed
authorGregor Boirie <gregor.boirie@parrot.com>
Tue, 19 Apr 2016 09:18:39 +0000 (11:18 +0200)
committerJonathan Cameron <jic23@kernel.org>
Sun, 29 May 2016 15:04:17 +0000 (16:04 +0100)
Use SMBus "block read" protocol only when supported by adapter.

Signed-off-by: Gregor Boirie <gregor.boirie@parrot.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
drivers/iio/common/st_sensors/st_sensors_i2c.c

index 98cfee296d4622f92119b44af2fd3b1b0e59f8fc..b43aa36031f88a318469882ae011f159408bacf0 100644 (file)
@@ -48,8 +48,8 @@ static int st_sensors_i2c_read_multiple_byte(
        if (multiread_bit)
                reg_addr |= ST_SENSORS_I2C_MULTIREAD;
 
-       return i2c_smbus_read_i2c_block_data(to_i2c_client(dev),
-                                                       reg_addr, len, data);
+       return i2c_smbus_read_i2c_block_data_or_emulated(to_i2c_client(dev),
+                                                        reg_addr, len, data);
 }
 
 static int st_sensors_i2c_write_byte(struct st_sensor_transfer_buffer *tb,