mirror of https://github.com/torvalds/linux.git
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>
This commit is contained in:
parent
006f661e02
commit
6ae5101d6f
|
|
@ -40,7 +40,7 @@
|
||||||
#define CTL_GET_TMP 0x11 /*
|
#define CTL_GET_TMP 0x11 /*
|
||||||
* send: byte 1 is channel, rest zero
|
* send: byte 1 is channel, rest zero
|
||||||
* rcv: returns temp for channel in centi-degree celsius
|
* rcv: returns temp for channel in centi-degree celsius
|
||||||
* in bytes 1 and 2
|
* in bytes 1 and 2 as a two's complement value
|
||||||
* returns 0x11 in byte 0 if no sensor is connected
|
* returns 0x11 in byte 0 if no sensor is connected
|
||||||
*/
|
*/
|
||||||
#define CTL_GET_VOLT 0x12 /*
|
#define CTL_GET_VOLT 0x12 /*
|
||||||
|
|
@ -258,7 +258,7 @@ static int ccp_read(struct device *dev, enum hwmon_sensor_types type,
|
||||||
ret = get_data(ccp, CTL_GET_TMP, channel, true);
|
ret = get_data(ccp, CTL_GET_TMP, channel, true);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
*val = ret * 10;
|
*val = (s16)ret * 10;
|
||||||
return 0;
|
return 0;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue