wil6210: fix temperature debugfs

[ Upstream commit 6d9eb7ebae3d7e951bc0999235ae7028eb4cae4f ]

For negative temperatures, "temp" debugfs is showing wrong values.
Use signed types so proper calculations is done for sub zero
temperatures.

Signed-off-by: Dedy Lansky <dlansky@codeaurora.org>
Signed-off-by: Maya Erez <merez@codeaurora.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Dedy Lansky 2020-04-21 13:40:02 +01:00 committed by Greg Kroah-Hartman
parent 243ec87d96
commit 6457ade9bc

View File

@ -1091,7 +1091,7 @@ static const struct file_operations fops_ssid = {
};
/*---------temp------------*/
static void print_temp(struct seq_file *s, const char *prefix, u32 t)
static void print_temp(struct seq_file *s, const char *prefix, s32 t)
{
switch (t) {
case 0:
@ -1099,7 +1099,8 @@ static void print_temp(struct seq_file *s, const char *prefix, u32 t)
seq_printf(s, "%s N/A\n", prefix);
break;
default:
seq_printf(s, "%s %d.%03d\n", prefix, t / 1000, t % 1000);
seq_printf(s, "%s %s%d.%03d\n", prefix, (t < 0 ? "-" : ""),
abs(t / 1000), abs(t % 1000));
break;
}
}
@ -1107,7 +1108,7 @@ static void print_temp(struct seq_file *s, const char *prefix, u32 t)
static int wil_temp_debugfs_show(struct seq_file *s, void *data)
{
struct wil6210_priv *wil = s->private;
u32 t_m, t_r;
s32 t_m, t_r;
int rc = wmi_get_temperature(wil, &t_m, &t_r);
if (rc) {