Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

gpio: pca953x: remove incorrect le16_to_cpu calls

i2c_smbus commands handle the correct byte order for smbus transactions
internally. This will currently result in incorrect operation on big
endian systems.

Suggested-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

authored by

Andy Shevchenko and committed by
Linus Walleij
b2dc4110 ef954844

+3 -5
+3 -5
drivers/gpio/gpio-pca953x.c
··· 187 187 188 188 static int pca953x_write_regs_16(struct pca953x_chip *chip, int reg, u8 *val) 189 189 { 190 - __le16 word = cpu_to_le16(get_unaligned((u16 *)val)); 190 + u16 word = get_unaligned((u16 *)val); 191 191 192 - return i2c_smbus_write_word_data(chip->client, 193 - reg << 1, (__force u16)word); 192 + return i2c_smbus_write_word_data(chip->client, reg << 1, word); 194 193 } 195 194 196 195 static int pca957x_write_regs_16(struct pca953x_chip *chip, int reg, u8 *val) ··· 240 241 int ret; 241 242 242 243 ret = i2c_smbus_read_word_data(chip->client, reg << 1); 243 - val[0] = (u16)ret & 0xFF; 244 - val[1] = (u16)ret >> 8; 244 + put_unaligned(ret, (u16 *)val); 245 245 246 246 return ret; 247 247 }