]> git.itanic.dy.fi Git - linux-stable/commit
hwmon: (tps23861) fix byte order in resistance register
authorAlexandru Gagniuc <mr.nuke.me@gmail.com>
Mon, 5 Sep 2022 14:28:04 +0000 (09:28 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 15 Sep 2022 08:47:18 +0000 (10:47 +0200)
commitf3cf916c93dca6df7ec189d0265dd3f910bf6c7b
treeb2eed463b35c8afc9758af9c5e5c2575f000d27f
parent0f9f9c73da37c945bb14363378908342e7e5db59
hwmon: (tps23861) fix byte order in resistance register

commit 1f05f65bddd6958d25b133f886da49c1d4bff3fa upstream.

The tps23861 registers are little-endian, and regmap_read_bulk() does
not do byte order conversion. On BE machines, the bytes were swapped,
and the interpretation of the resistance value was incorrect.

To make it work on both big and little-endian machines, use
le16_to_cpu() to convert the resitance register to host byte order.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Fixes: fff7b8ab22554 ("hwmon: add Texas Instruments TPS23861 driver")
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20220905142806.110598-1-mr.nuke.me@gmail.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/hwmon/tps23861.c