From: Hyeonseong Gil Date: Fri, 24 Mar 2017 01:59:09 +0000 (+0900) Subject: [COMMON] thermal: samsung: Replace to get cdev data X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=c1f4d8add2d866e79a7c630568cfb5a9875765d0;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git [COMMON] thermal: samsung: Replace to get cdev data Change-Id: I5f706db307e107d6ea129a6864396f75d480efa5 Signed-off-by: Hyeonseong Gil --- diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c index 94e6bccbe3e1..8ec8450f695e 100644 --- a/drivers/thermal/samsung/exynos_tmu.c +++ b/drivers/thermal/samsung/exynos_tmu.c @@ -928,7 +928,9 @@ static void exynos78XX_tmu_control(struct platform_device *pdev, bool on) static int exynos_get_temp(void *p, int *temp) { struct exynos_tmu_data *data = p; - struct thermal_cooling_device *cdev; + struct thermal_cooling_device *cdev = NULL; + struct thermal_zone_device *tz; + struct thermal_instance *instance; #ifdef CONFIG_EXYNOS_MCINFO unsigned int mcinfo_count; unsigned int mcinfo_result[4] = {0, 0, 0, 0}; @@ -949,7 +951,14 @@ static int exynos_get_temp(void *p, int *temp) mutex_unlock(&data->lock); - cdev = data->cool_dev; + tz = data->tzd; + + list_for_each_entry(instance, &tz->thermal_instances, tz_node) { + if (instance->cdev) { + cdev = instance->cdev; + break; + } + } if (!cdev) return 0; @@ -1192,14 +1201,22 @@ static int exynos_pm_notifier(struct notifier_block *notifier, unsigned long event, void *v) { struct exynos_tmu_data *devnode; - struct thermal_cooling_device *cdev; + struct thermal_cooling_device *cdev = NULL; + struct thermal_zone_device *tz; + struct thermal_instance *instance; switch (event) { case PM_SUSPEND_PREPARE: mutex_lock(&thermal_suspend_lock); suspended = true; list_for_each_entry(devnode, &dtm_dev_list, node) { - cdev = devnode->cool_dev; + tz = devnode->tzd; + list_for_each_entry(instance, &tz->thermal_instances, tz_node) { + if (instance->cdev) { + cdev = instance->cdev; + break; + } + } if (cdev && cdev->ops->set_cur_temp && devnode->id != 1) cdev->ops->set_cur_temp(cdev, suspended, 0); @@ -1211,6 +1228,13 @@ static int exynos_pm_notifier(struct notifier_block *notifier, suspended = false; list_for_each_entry(devnode, &dtm_dev_list, node) { cdev = devnode->cool_dev; + tz = devnode->tzd; + list_for_each_entry(instance, &tz->thermal_instances, tz_node) { + if (instance->cdev) { + cdev = instance->cdev; + break; + } + } if (cdev && cdev->ops->set_cur_temp && devnode->id != 1) cdev->ops->set_cur_temp(cdev, suspended, devnode->tzd->temperature / 1000);