Commit fa4f9893 authored by Dedy Lansky's avatar Dedy Lansky Committed by Kleber Sacilotto de Souza

wil6210: fix temperature debugfs

BugLink: https://bugs.launchpad.net/bugs/1875905

[ Upstream commit 6d9eb7eb ]

For negative temperatures, "temp" debugfs is showing wrong values.
Use signed types so proper calculations is done for sub zero
temperatures.
Signed-off-by: default avatarDedy Lansky <dlansky@codeaurora.org>
Signed-off-by: default avatarMaya Erez <merez@codeaurora.org>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
Signed-off-by: default avatarLee Jones <lee.jones@linaro.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarIan May <ian.may@canonical.com>
Signed-off-by: default avatarKleber Sacilotto de Souza <kleber.souza@canonical.com>
parent abe43663
......@@ -1088,7 +1088,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:
......@@ -1096,7 +1096,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;
}
}
......@@ -1104,7 +1105,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) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment