Skip to content

Commit 88cc4b1

Browse files
JianyuWang0623xiaoxiang781216
authored andcommitted
Thermal/procfs: Disabled immediately after enabling.
When exec "echo 1 > /proc/thermal/cpu-thermal", procfs get "\n" after "1", treat as disable: ``` #1 0x000000000040f452 in thermal_procfs_write (filep=0x7ffff3d241e8, buffer=0x7ffff3d344fc "\n", buflen=1) at thermal/thermal_procfs.c:179 ``` Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
1 parent d5ffed6 commit 88cc4b1

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

drivers/thermal/thermal_procfs.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,15 @@ static ssize_t thermal_procfs_write(FAR struct file *filep,
174174
{
175175
FAR struct thermal_procfs_s *p = filep->f_priv;
176176

177-
thermal_zone_enable(p->zdev, atoi(buffer) ? true : false);
177+
if (!strncmp(buffer, "1", 1))
178+
{
179+
thermal_zone_enable(p->zdev, true);
180+
}
181+
else if (!strncmp(buffer, "0", 1))
182+
{
183+
thermal_zone_enable(p->zdev, false);
184+
}
185+
178186
return buflen;
179187
}
180188

0 commit comments

Comments
 (0)