From 1024a5132d048ea3afe23cbef0f804ce1d545ce9 Mon Sep 17 00:00:00 2001 From: leoliu-oc Date: Tue, 4 Nov 2025 09:46:58 +0800 Subject: [PATCH 1/2] anolis: Optimize VIA CPU Temp Monitoring During Suspend/Resume ANBZ: #28499 This patch improves the VIA CPU temperature driver's behavior during suspend and resume. It adds conditions in 'via_cputemp_online' and 'via_cputemp_down_prep' functions to skip processes when the system is suspending or resuming, using 'cpuhp_tasks_frozen'. This prevents potential lock-ups and ensures smoother temperature monitoring during power state transitions. Signed-off-by: leoliu-oc --- drivers/hwmon/via-cputemp.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/drivers/hwmon/via-cputemp.c b/drivers/hwmon/via-cputemp.c index 0a5057dbe51a..c79fa618efaf 100644 --- a/drivers/hwmon/via-cputemp.c +++ b/drivers/hwmon/via-cputemp.c @@ -216,6 +216,13 @@ static int via_cputemp_online(unsigned int cpu) struct platform_device *pdev; struct pdev_entry *pdev_entry; + /* + * Don't execute this on suspend as the device remove locks + * up the machine. + */ + if (cpuhp_tasks_frozen) + return 0; + pdev = platform_device_alloc(DRVNAME, cpu); if (!pdev) { err = -ENOMEM; @@ -255,6 +262,13 @@ static int via_cputemp_down_prep(unsigned int cpu) { struct pdev_entry *p; + /* + * Don't execute this on suspend as the device remove locks + * up the machine. + */ + if (cpuhp_tasks_frozen) + return 0; + mutex_lock(&pdev_list_mutex); list_for_each_entry(p, &pdev_list, list) { if (p->cpu == cpu) { -- Gitee From 5a3dc4547316ffdc2f06ccee4d9745d6f99748ac Mon Sep 17 00:00:00 2001 From: leoliu-oc Date: Tue, 4 Nov 2025 09:46:59 +0800 Subject: [PATCH 2/2] anolis: Optimize Zhaoxin CPU Temp Monitoring During Suspend/Resume ANBZ: #28499 Modified 'zhaoxin_cputemp_down_prep' to avoid system freezes during suspend by skipping device removal when 'cpuhp_tasks_frozen' is true. Signed-off-by: leoliu-oc --- drivers/hwmon/zhaoxin-cputemp.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/drivers/hwmon/zhaoxin-cputemp.c b/drivers/hwmon/zhaoxin-cputemp.c index f93b291e61a9..479e3bcf0372 100644 --- a/drivers/hwmon/zhaoxin-cputemp.c +++ b/drivers/hwmon/zhaoxin-cputemp.c @@ -210,6 +210,13 @@ static int zhaoxin_cputemp_online(unsigned int cpu) struct platform_device *pdev; struct pdev_entry *pdev_entry; + /* + * Don't execute this on suspend as the device remove locks + * up the machine. + */ + if (cpuhp_tasks_frozen) + return 0; + pdev = platform_device_alloc(DRVNAME, cpu); if (!pdev) { err = -ENOMEM; @@ -249,6 +256,13 @@ static int zhaoxin_cputemp_down_prep(unsigned int cpu) { struct pdev_entry *p; + /* + * Don't execute this on suspend as the device remove locks + * up the machine. + */ + if (cpuhp_tasks_frozen) + return 0; + mutex_lock(&pdev_list_mutex); list_for_each_entry(p, &pdev_list, list) { if (p->cpu == cpu) { -- Gitee