summaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/tps23861.c
diff options
context:
space:
mode:
authorWolfram Sang <wsa@kernel.org>2022-09-16 21:42:18 +0200
committerWolfram Sang <wsa@kernel.org>2022-09-16 21:42:18 +0200
commitd819524d3144f4703f45f473fdc85ad7579ae94c (patch)
tree9bcb29b9b1a24ecf5a1a367c1af7d9be138ba041 /drivers/hwmon/tps23861.c
parenti2c: rk3x: Add rv1126 support (diff)
parentLinux 6.0-rc5 (diff)
downloadlinux-d819524d3144f4703f45f473fdc85ad7579ae94c.tar.xz
linux-d819524d3144f4703f45f473fdc85ad7579ae94c.zip
Merge tag 'v6.0-rc5' into i2c/for-mergewindow
Linux 6.0-rc5
Diffstat (limited to 'drivers/hwmon/tps23861.c')
-rw-r--r--drivers/hwmon/tps23861.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/hwmon/tps23861.c b/drivers/hwmon/tps23861.c
index 864dd2f96968..5e3fc2251510 100644
--- a/drivers/hwmon/tps23861.c
+++ b/drivers/hwmon/tps23861.c
@@ -493,18 +493,20 @@ static char *tps23861_port_poe_plus_status(struct tps23861_data *data, int port)
static int tps23861_port_resistance(struct tps23861_data *data, int port)
{
- u16 regval;
+ unsigned int raw_val;
+ __le16 regval;
regmap_bulk_read(data->regmap,
PORT_1_RESISTANCE_LSB + PORT_N_RESISTANCE_LSB_OFFSET * (port - 1),
&regval,
2);
- switch (FIELD_GET(PORT_RESISTANCE_RSN_MASK, regval)) {
+ raw_val = le16_to_cpu(regval);
+ switch (FIELD_GET(PORT_RESISTANCE_RSN_MASK, raw_val)) {
case PORT_RESISTANCE_RSN_OTHER:
- return (FIELD_GET(PORT_RESISTANCE_MASK, regval) * RESISTANCE_LSB) / 10000;
+ return (FIELD_GET(PORT_RESISTANCE_MASK, raw_val) * RESISTANCE_LSB) / 10000;
case PORT_RESISTANCE_RSN_LOW:
- return (FIELD_GET(PORT_RESISTANCE_MASK, regval) * RESISTANCE_LSB_LOW) / 10000;
+ return (FIELD_GET(PORT_RESISTANCE_MASK, raw_val) * RESISTANCE_LSB_LOW) / 10000;
case PORT_RESISTANCE_RSN_SHORT:
case PORT_RESISTANCE_RSN_OPEN:
default: