]> www.infradead.org Git - users/sagi/nvme-cli.git/commitdiff
nvme-cli: smart-log: Allow negative values for temp sensors.
authorChaitanya Kulkarni <chaitanya.kulkarni@hgst.com>
Sun, 26 Feb 2017 07:34:42 +0000 (23:34 -0800)
committerKeith Busch <keith.busch@intel.com>
Mon, 27 Feb 2017 15:04:47 +0000 (10:04 -0500)
HGST devices allowed to produce valid negative values for
"Temperature Sensor 1" of the smart-log command. Change the
temperature sensor value from unsigned to signed so that
negative values will be printed correctly.

Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@hgst.com>
Reviewed-by: Sagi Grimberg <sagi@grimbeg.me>
Signed-off-by: Keith Busch <keith.busch@intel.com>
nvme-print.c

index b466aeef35ec279a0c66a9841c56f66ab9fafaa6..d4dd7d5788d2c363b20833d288807a5d757eafb6 100644 (file)
@@ -805,8 +805,8 @@ void show_smart_log(struct nvme_smart_log *smart, unsigned int nsid, const char
        printf("Warning Temperature Time            : %u\n", le32_to_cpu(smart->warning_temp_time));
        printf("Critical Composite Temperature Time : %u\n", le32_to_cpu(smart->critical_comp_time));
        for (c=0; c < 8; c++) {
-               __u16 temp = le16_to_cpu(smart->temp_sensor[c]);
-               printf("Temperature Sensor %d                : %u C\n", c + 1,
+               __s32 temp = le16_to_cpu(smart->temp_sensor[c]);
+               printf("Temperature Sensor %d                : %d C\n", c + 1,
                        temp ? temp - 273 : 0);
        }
 }