From ece238fe0aabac2278f39803c7344e2f6ff0dca2 Mon Sep 17 00:00:00 2001 From: Regid Ichira Date: Mon, 9 Sep 2013 00:58:53 +0300 Subject: typo in drivers/thermal/Kconfig: lpatform instead of platform Applied to the HEAD of linux.git, VERSION = 3 PATCHLEVEL = 11 SUBLEVEL = 0 Signed-off-by: Regid Ichira Acked-by: Eduardo Valentin Signed-off-by: Zhang Rui --- drivers/thermal/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/thermal') diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig index dbfc390330ac..57e06a9977cb 100644 --- a/drivers/thermal/Kconfig +++ b/drivers/thermal/Kconfig @@ -56,7 +56,7 @@ config THERMAL_DEFAULT_GOV_USER_SPACE select THERMAL_GOV_USER_SPACE help Select this if you want to let the user space manage the - lpatform thermals. + platform thermals. endchoice -- cgit v1.2.3 From a822794886e9746b30b62d11e594865bcc7a0988 Mon Sep 17 00:00:00 2001 From: Luka Perkov Date: Fri, 27 Sep 2013 20:20:33 +0200 Subject: thermal: Kconfig: cosmetic fixes Fix typo, finish sentence and add missing dots. Signed-off-by: Luka Perkov CC: Randy Dunlap Acked-by: Eduardo Valentin Signed-off-by: Zhang Rui --- drivers/thermal/Kconfig | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'drivers/thermal') diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig index 57e06a9977cb..3910b09b84e0 100644 --- a/drivers/thermal/Kconfig +++ b/drivers/thermal/Kconfig @@ -69,6 +69,7 @@ config THERMAL_GOV_STEP_WISE bool "Step_wise thermal governor" help Enable this to manage platform thermals using a simple linear + governor. config THERMAL_GOV_USER_SPACE bool "User_space thermal governor" @@ -117,14 +118,14 @@ config SPEAR_THERMAL depends on OF help Enable this to plug the SPEAr thermal sensor driver into the Linux - thermal framework + thermal framework. config RCAR_THERMAL tristate "Renesas R-Car thermal driver" depends on ARCH_SHMOBILE help Enable this to plug the R-Car thermal sensor driver into the Linux - thermal framework + thermal framework. config KIRKWOOD_THERMAL tristate "Temperature sensor on Marvell Kirkwood SoCs" -- cgit v1.2.3 From c32a5087b70a6706ebee70c4a56849f89c0503f7 Mon Sep 17 00:00:00 2001 From: "durgadoss.r@intel.com" Date: Fri, 4 Oct 2013 21:53:24 +0530 Subject: Thermal: Tidy up error handling in powerclamp_init This patch * adds missing kfree() for cpu_clamping_mask * adds return value checking for alloc_percpu() * unregister hotcpu notifier in exit path Signed-off-by: Durgadoss R Signed-off-by: Zhang Rui --- drivers/thermal/intel_powerclamp.c | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) (limited to 'drivers/thermal') diff --git a/drivers/thermal/intel_powerclamp.c b/drivers/thermal/intel_powerclamp.c index b40b37cd25e0..a7cd170b86d2 100644 --- a/drivers/thermal/intel_powerclamp.c +++ b/drivers/thermal/intel_powerclamp.c @@ -758,21 +758,39 @@ static int powerclamp_init(void) /* probe cpu features and ids here */ retval = powerclamp_probe(); if (retval) - return retval; + goto exit_free; + /* set default limit, maybe adjusted during runtime based on feedback */ window_size = 2; register_hotcpu_notifier(&powerclamp_cpu_notifier); + powerclamp_thread = alloc_percpu(struct task_struct *); + if (!powerclamp_thread) { + retval = -ENOMEM; + goto exit_unregister; + } + cooling_dev = thermal_cooling_device_register("intel_powerclamp", NULL, &powerclamp_cooling_ops); - if (IS_ERR(cooling_dev)) - return -ENODEV; + if (IS_ERR(cooling_dev)) { + retval = -ENODEV; + goto exit_free_thread; + } if (!duration) duration = jiffies_to_msecs(DEFAULT_DURATION_JIFFIES); + powerclamp_create_debug_files(); return 0; + +exit_free_thread: + free_percpu(powerclamp_thread); +exit_unregister: + unregister_hotcpu_notifier(&powerclamp_cpu_notifier); +exit_free: + kfree(cpu_clamping_mask); + return retval; } module_init(powerclamp_init); -- cgit v1.2.3 From 90fc9cd286846f884e35fb6a611d0c50f2d21a26 Mon Sep 17 00:00:00 2001 From: Jacob Pan Date: Thu, 26 Sep 2013 04:33:25 -0700 Subject: thermal/intel_powerclamp: Add newer CPU models This will enable intel_powerclamp driver on newer Intel CPUs including some Ivy Bridge and Haswell processors. Signed-off-by: Jacob Pan Signed-off-by: Zhang Rui --- drivers/thermal/intel_powerclamp.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'drivers/thermal') diff --git a/drivers/thermal/intel_powerclamp.c b/drivers/thermal/intel_powerclamp.c index a7cd170b86d2..8f181b3f842b 100644 --- a/drivers/thermal/intel_powerclamp.c +++ b/drivers/thermal/intel_powerclamp.c @@ -675,6 +675,11 @@ static const struct x86_cpu_id intel_powerclamp_ids[] = { { X86_VENDOR_INTEL, 6, 0x2e}, { X86_VENDOR_INTEL, 6, 0x2f}, { X86_VENDOR_INTEL, 6, 0x3a}, + { X86_VENDOR_INTEL, 6, 0x3c}, + { X86_VENDOR_INTEL, 6, 0x3e}, + { X86_VENDOR_INTEL, 6, 0x3f}, + { X86_VENDOR_INTEL, 6, 0x45}, + { X86_VENDOR_INTEL, 6, 0x46}, {} }; MODULE_DEVICE_TABLE(x86cpu, intel_powerclamp_ids); -- cgit v1.2.3 From 732e4c8db99cb3125bd6865794ec8e3a998c4d6e Mon Sep 17 00:00:00 2001 From: "durgadoss.r@intel.com" Date: Wed, 2 Oct 2013 00:08:00 +0530 Subject: Thermal: Check for validity before doing kfree The thermal_release function is called whenever any device belonging to 'thermal' class unregisters. This function performs kfree(cdev) without any check. In cases where there are more device registrations other than just 'thermal_zone' and 'cooling_device' this might accidently free memory allocated them silently; and cause memory errors. This patch changes this behavior by doing kfree(cdev) only when the device pointer belongs to a real cdev i.e. cooling_device. Signed-off-by: Durgadoss R Signed-off-by: Zhang Rui --- drivers/thermal/thermal_core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'drivers/thermal') diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c index 4962a6aaf295..db99b334712a 100644 --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c @@ -1038,7 +1038,8 @@ static void thermal_release(struct device *dev) sizeof("thermal_zone") - 1)) { tz = to_thermal_zone(dev); kfree(tz); - } else { + } else if(!strncmp(dev_name(dev), "cooling_device", + sizeof("cooling_device") - 1)){ cdev = to_cooling_device(dev); kfree(cdev); } -- cgit v1.2.3 From 73b9bcd76d13716cc0e0ab053f8c1ae41f47636e Mon Sep 17 00:00:00 2001 From: Wei Yongjun Date: Fri, 25 Oct 2013 21:55:42 +0800 Subject: thermal: cpu_cooling: fix return value check in cpufreq_cooling_register() In case of error, the function thermal_cooling_device_register() returns ERR_PTR() and never returns NULL. The NULL test in the return value check should be replaced with IS_ERR(). Signed-off-by: Wei Yongjun Signed-off-by: Zhang Rui --- drivers/thermal/cpu_cooling.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/thermal') diff --git a/drivers/thermal/cpu_cooling.c b/drivers/thermal/cpu_cooling.c index d17902886c3f..02a46f23d14c 100644 --- a/drivers/thermal/cpu_cooling.c +++ b/drivers/thermal/cpu_cooling.c @@ -469,10 +469,10 @@ cpufreq_cooling_register(const struct cpumask *clip_cpus) cool_dev = thermal_cooling_device_register(dev_name, cpufreq_dev, &cpufreq_cooling_ops); - if (!cool_dev) { + if (IS_ERR(cool_dev)) { release_idr(&cpufreq_idr, cpufreq_dev->id); kfree(cpufreq_dev); - return ERR_PTR(-EINVAL); + return cool_dev; } cpufreq_dev->cool_dev = cool_dev; cpufreq_dev->cpufreq_state = 0; -- cgit v1.2.3 From a9f2d19ba7be38590c84487359891d45a66b62f4 Mon Sep 17 00:00:00 2001 From: Ni Wade Date: Wed, 6 Nov 2013 14:30:13 +0800 Subject: thermal: Fix binding problem when there is thermal zone params The thermal zone params can be used to set governor to specific thermal governor for thermal zone device. But if the thermal zone params has only governor name without thermal bind params, then the thermal zone device will not be binding to cooling device. Because tz->ops->bind operator is not invoked in bind_tz() and bind_cdev() when there is thermal zone params. Signed-off-by: Wei Ni Signed-off-by: Jinyoung Park Signed-off-by: Zhang Rui --- drivers/thermal/thermal_core.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'drivers/thermal') diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c index db99b334712a..03a567199bbe 100644 --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c @@ -247,10 +247,11 @@ static void bind_cdev(struct thermal_cooling_device *cdev) if (!pos->tzp && !pos->ops->bind) continue; - if (!pos->tzp && pos->ops->bind) { + if (pos->ops->bind) { ret = pos->ops->bind(pos, cdev); if (ret) print_bind_err_msg(pos, cdev, ret); + continue; } tzp = pos->tzp; @@ -282,8 +283,8 @@ static void bind_tz(struct thermal_zone_device *tz) mutex_lock(&thermal_list_lock); - /* If there is no platform data, try to use ops->bind */ - if (!tzp && tz->ops->bind) { + /* If there is ops->bind, try to use ops->bind */ + if (tz->ops->bind) { list_for_each_entry(pos, &thermal_cdev_list, node) { ret = tz->ops->bind(tz, pos); if (ret) -- cgit v1.2.3