From: Eunseok Choi Date: Thu, 14 Dec 2017 08:58:48 +0000 (+0900) Subject: [COMMON] thermal: delay cpu hotplug until cdev is initialized X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=91a5669d3daa069a7571863e2360a519ecbc4f95;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git [COMMON] thermal: delay cpu hotplug until cdev is initialized Change-Id: I46e252cde6c2fbaa09acffc1352d6fae4d1496fd Signed-off-by: Eunseok Choi --- diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c index c60989baedc8..1c38e41d1374 100644 --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c @@ -497,7 +497,7 @@ void thermal_zone_device_update(struct thermal_zone_device *tz, handle_thermal_trip(tz, count); if (event != THERMAL_DEVICE_POWER_CAPABILITY_CHANGED) { - if (tz->ops->throttle_hotplug) + if (tz->ops->throttle_hotplug && tz->cdev_bound) tz->ops->throttle_hotplug(tz); } } @@ -1010,9 +1010,11 @@ __thermal_cooling_device_register(struct device_node *np, mutex_lock(&thermal_list_lock); list_for_each_entry(pos, &thermal_tz_list, node) - if (atomic_cmpxchg(&pos->need_update, 1, 0)) + if (atomic_cmpxchg(&pos->need_update, 1, 0)) { + pos->cdev_bound = true; thermal_zone_device_update(pos, THERMAL_EVENT_UNSPECIFIED); + } mutex_unlock(&thermal_list_lock); return cdev; diff --git a/include/linux/thermal.h b/include/linux/thermal.h index a6fc833258f6..c82bd1e4860f 100644 --- a/include/linux/thermal.h +++ b/include/linux/thermal.h @@ -207,6 +207,7 @@ struct thermal_attr { * @node: node in thermal_tz_list (in thermal_core.c) * @poll_queue: delayed work for polling * @notify_event: Last notification event + * @cdev_bound: cooling device bind done */ struct thermal_zone_device { int id; @@ -239,6 +240,7 @@ struct thermal_zone_device { struct list_head node; struct delayed_work poll_queue; enum thermal_notify_event notify_event; + bool cdev_bound; }; /**