summaryrefslogtreecommitdiff
path: root/drivers/hwmon/tps23861.c
diff options
context:
space:
mode:
authorWolfram Sang <wsa@kernel.org>2022-09-16 20:42:18 +0100
committerWolfram Sang <wsa@kernel.org>2022-09-16 20:42:18 +0100
commitd819524d3144f4703f45f473fdc85ad7579ae94c (patch)
tree9bcb29b9b1a24ecf5a1a367c1af7d9be138ba041 /drivers/hwmon/tps23861.c
parent859d64685d6c868db62b86064769b053db8bf834 (diff)
parent80e78fcce86de0288793a0ef0f6acf37656ee4cf (diff)
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: