summaryrefslogtreecommitdiff
path: root/include/linux/mfd
diff options
context:
space:
mode:
authorJonathan Cameron <Jonathan.Cameron@huawei.com>2019-10-13 12:30:15 +0300
committerLee Jones <lee.jones@linaro.org>2019-11-11 11:45:02 +0300
commitcbfdc839ea913250bd38528408addf44b27e9e5f (patch)
tree5759c218d36ff1d0846c8e9ebad39b3e2946b0ce /include/linux/mfd
parent11c4f2be58c24a43e60f1379e6f23ba027b740e3 (diff)
downloadlinux-cbfdc839ea913250bd38528408addf44b27e9e5f.tar.xz
mfd: twl: Endian fixups in i2c write and read wrappers
Use a local variable to ensure correct endian types for intermediate results. Identified by sparse when building the IIO driver. Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>
Diffstat (limited to 'include/linux/mfd')
-rw-r--r--include/linux/mfd/twl.h12
1 files changed, 8 insertions, 4 deletions
diff --git a/include/linux/mfd/twl.h b/include/linux/mfd/twl.h
index 44aff52a5002..089e8942223a 100644
--- a/include/linux/mfd/twl.h
+++ b/include/linux/mfd/twl.h
@@ -181,14 +181,18 @@ static inline int twl_i2c_read_u8(u8 mod_no, u8 *val, u8 reg) {
}
static inline int twl_i2c_write_u16(u8 mod_no, u16 val, u8 reg) {
- val = cpu_to_le16(val);
- return twl_i2c_write(mod_no, (u8*) &val, reg, 2);
+ __le16 value;
+
+ value = cpu_to_le16(val);
+ return twl_i2c_write(mod_no, (u8 *) &value, reg, 2);
}
static inline int twl_i2c_read_u16(u8 mod_no, u16 *val, u8 reg) {
int ret;
- ret = twl_i2c_read(mod_no, (u8*) val, reg, 2);
- *val = le16_to_cpu(*val);
+ __le16 value;
+
+ ret = twl_i2c_read(mod_no, (u8 *) &value, reg, 2);
+ *val = le16_to_cpu(value);
return ret;
}