diff options
author | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2016-05-31 22:03:43 +0300 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2016-06-08 11:02:24 +0300 |
commit | c4d1cbd7cf4dbad8d657e279605657c0fc3b2d46 (patch) | |
tree | 06dcef6dcee3275f2ebfb9051f9afafd251216ae /drivers/gpio/gpio-pca953x.c | |
parent | 0ee37414991e1be21e0f168172f0ac260e375886 (diff) | |
download | linux-c4d1cbd7cf4dbad8d657e279605657c0fc3b2d46.tar.xz |
gpio: pca953x: enfore type for i2c_smbus_write_word_data()
The commit 9b8e3ec34318 ("gpio: pca953x: Use correct u16 value for register
word write") fixed regression in pca953x_write_regs(). At the same time the
solution introduced a sparse warning:
drivers/gpio/gpio-pca953x.c:168:39: warning: incorrect type in argument 3 (different base types)
drivers/gpio/gpio-pca953x.c:168:39: expected unsigned short [unsigned] [usertype] value
drivers/gpio/gpio-pca953x.c:168:39: got restricted __le16 [usertype] <noident>
Fix the code by enforcing the type of i2c_smbus_write_word_data() parameter.
Cc: Yong Li <sdliyong@gmail.com>
Cc: Phil Reid <preid@electromag.com.au>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/gpio/gpio-pca953x.c')
-rw-r--r-- | drivers/gpio/gpio-pca953x.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/gpio/gpio-pca953x.c b/drivers/gpio/gpio-pca953x.c index d8233bed4234..21b21cd1773b 100644 --- a/drivers/gpio/gpio-pca953x.c +++ b/drivers/gpio/gpio-pca953x.c @@ -163,10 +163,13 @@ static int pca953x_write_regs(struct pca953x_chip *chip, int reg, u8 *val) NBANK(chip), val); } else { switch (chip->chip_type) { - case PCA953X_TYPE: - ret = i2c_smbus_write_word_data(chip->client, - reg << 1, cpu_to_le16(get_unaligned((u16 *)val))); + case PCA953X_TYPE: { + __le16 word = cpu_to_le16(get_unaligned((u16 *)val)); + + ret = i2c_smbus_write_word_data(chip->client, reg << 1, + (__force u16)word); break; + } case PCA957X_TYPE: ret = i2c_smbus_write_byte_data(chip->client, reg << 1, val[0]); |