]> git.karo-electronics.de Git - karo-tx-linux.git/commit
hwmon: (ina2xx) Fix word size register read and write operations
authorGuenter Roeck <linux@roeck-us.net>
Tue, 11 Sep 2012 15:22:14 +0000 (08:22 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 2 Oct 2012 17:39:11 +0000 (10:39 -0700)
commit7f1adf647e76af1c5108b12b2e17331f69565d38
treef2c261349e920723eb520f0606e695744959c484
parentbc080eed5c61471ab1204b70bf7efe22c5181087
hwmon: (ina2xx) Fix word size register read and write operations

commit 080b98e9ab30734bda2f1b8b33cd55a4c4ef406a upstream.

The driver uses be16_to_cpu and cpu_to_be16 to convert data in SMBus word
operations from chip to host byte order. However, the data passed from and to
the SMBus word API functions is in host byte order, not in chip byte order.
Conversion should therefore use swab16 instead of be16 to change the byte order.

Replace driver internal word conversion functions with SMBus API functions to
solve the problem.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Acked-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/hwmon/ina2xx.c