diff options
author | Wolfram Sang <wsa@kernel.org> | 2022-09-16 21:42:18 +0200 |
---|---|---|
committer | Wolfram Sang <wsa@kernel.org> | 2022-09-16 21:42:18 +0200 |
commit | d819524d3144f4703f45f473fdc85ad7579ae94c (patch) | |
tree | 9bcb29b9b1a24ecf5a1a367c1af7d9be138ba041 /drivers/hwmon/tps23861.c | |
parent | i2c: rk3x: Add rv1126 support (diff) | |
parent | Linux 6.0-rc5 (diff) | |
download | linux-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.c | 10 |
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), ®val, 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: |