Skip to content

Commit 6ae5101

Browse files
MisterZ42groeck
authored andcommitted
hwmon: (corsair-cpro) Read temperature as a signed value
Convert temperature to s16 to correctly read negative temperatures. Signed-off-by: Marius Zachmann <mail@mariuszachmann.de> Link: https://lore.kernel.org/r/20251113100024.11103-2-mail@mariuszachmann.de [groeck: Updated subject, coding style] Signed-off-by: Guenter Roeck <linux@roeck-us.net>
1 parent 006f661 commit 6ae5101

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

drivers/hwmon/corsair-cpro.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
#define CTL_GET_TMP 0x11 /*
4141
* send: byte 1 is channel, rest zero
4242
* rcv: returns temp for channel in centi-degree celsius
43-
* in bytes 1 and 2
43+
* in bytes 1 and 2 as a two's complement value
4444
* returns 0x11 in byte 0 if no sensor is connected
4545
*/
4646
#define CTL_GET_VOLT 0x12 /*
@@ -258,7 +258,7 @@ static int ccp_read(struct device *dev, enum hwmon_sensor_types type,
258258
ret = get_data(ccp, CTL_GET_TMP, channel, true);
259259
if (ret < 0)
260260
return ret;
261-
*val = ret * 10;
261+
*val = (s16)ret * 10;
262262
return 0;
263263
default:
264264
break;

0 commit comments

Comments
 (0)