aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/thermal/thermal_core.c (follow)
AgeCommit message (Collapse)AuthorFilesLines
2018-11-30Thermal: do not clear passive state during system sleepWei Wang1-4/+8
commit ff140fea847e ("Thermal: handle thermal zone device properly during system sleep") added PM hook to call thermal zone reset during sleep. However resetting thermal zone will also clear the passive state and thus cancel the polling queue which leads the passive cooling device state not being cleared properly after sleep. thermal_pm_notify => thermal_zone_device_reset set passive to 0 thermal_zone_trip_update will skip update passive as `old_target == instance->target'. monitor_thermal_zone => thermal_zone_device_set_polling will cancel tz->poll_queue, so the cooling device state will not be changed afterwards. Reported-by: Kame Wang <kamewang@google.com> Signed-off-by: Wei Wang <wvw@google.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2018-11-30thermal: remove unused function parameterLukasz Luba1-4/+2
Clean unused parameter from internal framework function. Signed-off-by: Lukasz Luba <l.luba@partner.samsung.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2018-10-10thermal: core: using power_efficient_wq for thermal workerJeson Gao1-2/+4
For SMP systems, thermal worker should use power_efficient_wq in power saving mode, that will make scheduler more flexible on selecting an active core for running work handler to avoid keeping work handler always running on a single core, that will save some power. Even if 'power_efficient_wq' relevant configs are disabled 'system_freezable_power_efficient_wq' is identical to system_freezable_wq, behavior is unchanged. Signed-off-by: Jeson Gao <jeson.gao@unisoc.com> Signed-off-by: Chunyan Zhang <chunyan.zhang@unisoc.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2018-10-10thermal: core: Fix use-after-free in thermal_cooling_device_destroy_sysfsDmitry Osipenko1-1/+2
This patch fixes use-after-free that was detected by KASAN. The bug is triggered on a CPUFreq driver module unload by freeing 'cdev' on device unregister and then using the freed structure during of the cdev's sysfs data destruction. The solution is to unregister the sysfs at first, then destroy sysfs data and finally release the cooling device. Cc: <stable@vger.kernel.org> # v4.17+ Fixes: 8ea229511e06 ("thermal: Add cooling device's statistics in sysfs") Signed-off-by: Dmitry Osipenko <digetx@gmail.com> Acked-by: Viresh Kumar <viresh.kumar@linaro.org> Acked-by: Eduardo Valentin <edubezval@gmail.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2018-05-30drivers: thermal: Update license to SPDX formatLina Iyer1-4/+1
Update licences format for core thermal files. Signed-off-by: Lina Iyer <ilina@codeaurora.org> Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2018-05-22thermal: Shorten name of sysfs callbacksViresh Kumar1-3/+3
The naming isn't consistent across all sysfs callbacks in the thermal core, some have a short name like type_show() and others have long names like thermal_cooling_device_weight_show(). This patch tries to make it consistent by shortening the name of sysfs callbacks. Some of the sysfs files are named similarly for both thermal zone and cooling device (like: type) and to avoid name clash between their show/store routines, the cooling device specific sysfs callbacks are prefixed with "cdev_". Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2018-04-02thermal: Add cooling device's statistics in sysfsViresh Kumar1-1/+2
This extends the sysfs interface for thermal cooling devices and exposes some pretty useful statistics. These statistics have proven to be quite useful specially while doing benchmarks related to the task scheduler, where we want to make sure that nothing has disrupted the test, specially the cooling device which may have put constraints on the CPUs. The information exposed here tells us to what extent the CPUs were constrained by the thermal framework. The write-only "reset" file is used to reset the statistics. The read-only "time_in_state_ms" file shows the time (in msec) spent by the device in the respective cooling states, and it prints one line per cooling state. The read-only "total_trans" file shows single positive integer value showing the total number of cooling state transitions the device has gone through since the time the cooling device is registered or the time when statistics were reset last. The read-only "trans_table" file shows a two dimensional matrix, where an entry <i,j> (row i, column j) represents the number of transitions from State_i to State_j. This is how the directory structure looks like for a single cooling device: $ ls -R /sys/class/thermal/cooling_device0/ /sys/class/thermal/cooling_device0/: cur_state max_state power stats subsystem type uevent /sys/class/thermal/cooling_device0/power: autosuspend_delay_ms runtime_active_time runtime_suspended_time control runtime_status /sys/class/thermal/cooling_device0/stats: reset time_in_state_ms total_trans trans_table This is tested on ARM 64-bit Hisilicon hikey620 board running Ubuntu and ARM 64-bit Hisilicon hikey960 board running Android. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2017-08-11thermal: core: Fix resources release in error paths in thermal_zone_device_register()Christophe Jaillet1-10/+13
Reorder error handling code in order to fix some resources leaks in some cases: - 'tz' would leak if 'thermal_zone_create_device_groups()' fails - memory allocated by 'thermal_zone_create_device_groups()' would leak if 'device_register()' fails With this patch, we now have 2 error handling paths: one before 'device_register()', and one after it. This is needed because some resources are released in 'thermal_release()'. Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2017-08-11thermal: core: Use the new 'thermal_zone_destroy_device_groups()' helper functionChristophe Jaillet1-5/+1
Simplify code by using the new 'thermal_zone_destroy_device_groups()' helper function. Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2017-08-08thermal: core: fix some format issues on critical shutdown stringIcenowy Zheng1-1/+1
The critical shutdown notice string used to have some spaces missing, which makes it not so pretty. Add the spaces to satisfy usual English space rules. Reported-by: Mingcong Bai <jeffbai@aosc.io> Signed-off-by: Icenowy Zheng <icenowy@aosc.io> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2017-05-23thermal: core: make thermal_emergency_poweroff staticColin Ian King1-1/+1
Making thermal_emergency_poweroff static fixes sparse warning: drivers/thermal/thermal_core.c:6: warning: symbol 'thermal_emergency_poweroff' was not declared. Should it be static? Fixes: ef1d87e06ab4 ("thermal: core: Add a back up thermal shutdown mechanism") Acked-by: Keerthy <j-keerthy@ti.com> Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
2017-05-05thermal: core: Add a back up thermal shutdown mechanismKeerthy1-0/+53
orderly_poweroff is triggered when a graceful shutdown of system is desired. This may be used in many critical states of the kernel such as when subsystems detects conditions such as critical temperature conditions. However, in certain conditions in system boot up sequences like those in the middle of driver probes being initiated, userspace will be unable to power off the system in a clean manner and leaves the system in a critical state. In cases like these, the /sbin/poweroff will return success (having forked off to attempt powering off the system. However, the system overall will fail to completely poweroff (since other modules will be probed) and the system is still functional with no userspace (since that would have shut itself off). However, there is no clean way of detecting such failure of userspace powering off the system. In such scenarios, it is necessary for a backup workqueue to be able to force a shutdown of the system when orderly shutdown is not successful after a configurable time period. Reported-by: Nishanth Menon <nm@ti.com> Signed-off-by: Keerthy <j-keerthy@ti.com> Acked-by: Eduardo Valentin <edubezval@gmail.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2017-05-05thermal: core: Allow orderly_poweroff to be called only onceKeerthy1-1/+10
thermal_zone_device_check --> thermal_zone_device_update --> handle_thermal_trip --> handle_critical_trips --> orderly_poweroff The above sequence happens every 250/500 mS based on the configuration. The orderly_poweroff function is getting called every 250/500 mS. With a full fledged file system it takes at least 5-10 Seconds to power off gracefully. In that period due to the thermal_zone_device_check triggering periodically the thermal work queues bombard with orderly_poweroff calls multiple times eventually leading to failures in gracefully powering off the system. Make sure that orderly_poweroff is called only once. Signed-off-by: Keerthy <j-keerthy@ti.com> Acked-by: Eduardo Valentin <edubezval@gmail.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2017-02-22Merge branches 'thermal-core', 'thermal-soc', 'thermal-intel' and 'ida-conversion' into nextZhang Rui1-49/+26
2017-01-06thermal: core: move tz->device.groups cleanup to thermal_releaseJacob von Chorus1-5/+5
The device_unregister call in thermal_zone_device_unregister causes the thermal_zone_device structure to be freed before the call to free the dynamically allocated attribute groups. This leads to a kernel panic. Furthermore, the 4 calls to free the trip point attribute structures occur before the call to unregister the device, leading to a kernel panic when sysfs attempts to access the attributes to remove them. Here is an example of a kernel panic when the cpu thermal zones are removed upon cpu offline: BUG: unable to handle kernel NULL pointer dereference at (null) IP: strlen+0x0/0x20 <snip> Call Trace: ? kernfs_name_hash+0x17/0x80 kernfs_find_ns+0x3f/0xd0 kernfs_remove_by_name_ns+0x36/0xa0 remove_files.isra.1+0x36/0x70 sysfs_remove_group+0x44/0x90 sysfs_remove_groups+0x2e/0x50 device_remove_attrs+0x5e/0x90 device_del+0x1ea/0x350 device_unregister+0x1a/0x60 thermal_zone_device_unregister+0x1f2/0x210 pkg_thermal_cpu_offline+0x14f/0x1a0 [x86_pkg_temp_thermal] ? kzalloc.constprop.2+0x10/0x10 [x86_pkg_temp_thermal] cpuhp_invoke_callback+0x8d/0x3f0 cpuhp_down_callbacks+0x42/0x80 cpuhp_thread_fun+0x8b/0xf0 smpboot_thread_fn+0x110/0x160 kthread+0x101/0x140 ? sort_range+0x30/0x30 ? kthread_park+0x90/0x90 ret_from_fork+0x25/0x30 This patch moves the kfree calls to clean up the dynamic attributes to the thermal_class's thermal_zone_device release function. Cc: Zhang Rui <rui.zhang@intel.com> Cc: Eduardo Valentin <edubezval@gmail.com> Cc: linux-pm@vger.kernel.org Cc: linux-kernel@vger.kernel.org Tested-by: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com> Signed-off-by: Jacob von Chorus <jacobvonchorus@cwphoto.ca> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2017-01-04thermal core: convert ID allocation to IDAMatthew Wilcox1-49/+26
The thermal core does not use the ability to look up pointers by ID, so convert it from using an IDR to the more space-efficient IDA. Signed-off-by: Matthew Wilcox <mawilcox@microsoft.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2016-12-13Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linuxLinus Torvalds1-1138/+306
Pull thermal management updates from Zhang Rui: - Thermal core code reorganization and cleanup. Two new files are created for thermal sysfs I/F code and thermal helper functions (Eduardo Valentin). - Sanitize hotplug and locking for x86_pkg_temp driver (Thomas Gleixner) - Update MAINTAINER file for pwm-fan driver and Samsung thermal driver (Lukasz Majewski) - Fix module auto-load for max77620, tango and db8500 thermal driver (Javier Martinez Canillas) - Fix a bug that thermal hwmon sysfs I/F returns wrong critical trip point temperature value (Krzysztof Kozlowski) - Add Skylake PCH 100 series support for intel_pch_thermal driver (OGAWA Hirofumi) - Small fixes and cleanups for platform thermal drivers (Julia Lawall, Luis Henriques, Leo Yan, Stephen Boyd, Shawn Lin, Javi Merino and Lukasz Luba) * 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux: (76 commits) MAINTAINERS: Samsung: Update maintainer for PWM FAN and SAMSUNG THERMAL thermal/x86 pkg temp: Convert to hotplug state machine thermal/x86_pkg_temp: Sanitize package management thermal/x86_pkg_temp: Move work into package struct thermal/x86_pkg_temp: Move work scheduled flag into package struct thermal/x86_pkg_temp: Sanitize locking thermal/x86_pkg_temp: Cleanup code some more thermal/x86_pkg_temp: Cleanup namespace thermal/x86_pkg_temp: Get rid of ref counting thermal/x86_pkg_temp: Sanitize callback (de)initialization thermal/x86_pkg_temp: Replace open coded cpu search thermal/x86_pkg_temp: Remove redundant package search thermal/x86_pkg_temp: Cleanup thermal interrupt handling thermal: hwmon: Properly report critical temperature in sysfs devfreq_cooling: pass a pointer to devfreq in the power model callbacks devfreq_cooling: make the structs devfreq_cooling_xxx visible for all dt-bindings: rockchip-thermal: fix the misleading description thermal: rockchip: improve the warning log thermal: db8500: Fix module autoload thermal: tango: Fix module autoload ...
2016-11-23thermal: core: move slop and offset helpers to thermal_helpers.cEduardo Valentin1-30/+0
Reorganize code to reflect better placement. Cc: Zhang Rui <rui.zhang@intel.com> Cc: linux-pm@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Eduardo Valentin <edubezval@gmail.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2016-11-23thermal: core: use kzalloc(sizeof(*ptr),...)Eduardo Valentin1-4/+3
As a safety check, this patch changes thermal core to check for pointer content size, instead of type size, while allocating memory. Cc: Zhang Rui <rui.zhang@intel.com> Cc: linux-pm@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Eduardo Valentin <edubezval@gmail.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2016-11-23thermal: core: improve kerneldoc entry of thermal_cooling_device_unregisterEduardo Valentin1-3/+3
Improve description and keep 80 columns limit. Cc: Zhang Rui <rui.zhang@intel.com> Cc: linux-pm@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Eduardo Valentin <edubezval@gmail.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2016-11-23thermal: core: remove style warnings and checksEduardo Valentin1-11/+11
Removing several style issues in thermal code code. Cc: Zhang Rui <rui.zhang@intel.com> Cc: linux-pm@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Eduardo Valentin <edubezval@gmail.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2016-11-23thermal: core: remove void function return statementsEduardo Valentin1-2/+0
Simply removing useless returns of void functions. Cc: Zhang Rui <rui.zhang@intel.com> Cc: linux-pm@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Eduardo Valentin <edubezval@gmail.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2016-11-23thermal: core: standardize line breaking alignmentEduardo Valentin1-13/+19
Pass through the code to remove check suggested by checkpatch.pl (alignment to parenthesis): CHECK: Alignment should match open parenthesis Cc: Zhang Rui <rui.zhang@intel.com> Cc: linux-pm@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Eduardo Valentin <edubezval@gmail.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2016-11-23thermal: core: small style fix when checking for __find_governor()Eduardo Valentin1-2/+2
Remove style issue: CHECK: Comparison to NULL could be written "!__find_governor" + if (__find_governor(governor->name) == NULL) { Cc: Zhang Rui <rui.zhang@intel.com> Cc: linux-pm@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Eduardo Valentin <edubezval@gmail.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2016-11-23thermal: core: remove FSF address in the GPL noticeEduardo Valentin1-13/+0
Simplify the GPL notice by removing the FSF address. No need to track FSF location in this file. Cc: Zhang Rui <rui.zhang@intel.com> Cc: linux-pm@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Eduardo Valentin <edubezval@gmail.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2016-11-23thermal: core: add a comment describing the device management sectionEduardo Valentin1-2/+9
comment describing the section with function to handle registration, unregistration, binding, and unbinding of thermal devices. Cc: Zhang Rui <rui.zhang@intel.com> Cc: linux-pm@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Eduardo Valentin <edubezval@gmail.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2016-11-23thermal: core: add a comment describing the power actor sectionEduardo Valentin1-0/+7
Simply marking the power actor section and adding a comment describing it. Cc: Zhang Rui <rui.zhang@intel.com> Cc: linux-pm@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Eduardo Valentin <edubezval@gmail.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2016-11-23thermal: core: add a comment describing the main update loopEduardo Valentin1-0/+11
Simply marking the main update loop section and adding a comment describing it. Cc: Zhang Rui <rui.zhang@intel.com> Cc: linux-pm@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Eduardo Valentin <edubezval@gmail.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2016-11-23thermal: core: move notify to the zone update sectionEduardo Valentin1-18/+18
moving the helper function to closer to similar functions. Cc: Zhang Rui <rui.zhang@intel.com> Cc: linux-pm@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Eduardo Valentin <edubezval@gmail.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2016-11-23thermal: core: add inline to print_bind_err_msg()Eduardo Valentin1-2/+3
Given that this is simple wrapper, adding the inline flag. Cc: Zhang Rui <rui.zhang@intel.com> Cc: linux-pm@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Eduardo Valentin <edubezval@gmail.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2016-11-23thermal: core: move __bind() to where it is usedEduardo Valentin1-33/+33
Moving the helper to closer where it is used. Cc: Zhang Rui <rui.zhang@intel.com> Cc: linux-pm@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Eduardo Valentin <edubezval@gmail.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2016-11-23thermal: core: fix couple of style issues on __bind() helperEduardo Valentin1-5/+5
Removing style issues on __bind() and its helpers. Cc: Zhang Rui <rui.zhang@intel.com> Cc: linux-pm@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Eduardo Valentin <edubezval@gmail.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2016-11-23thermal: core: move bind_tz() to where it is usedEduardo Valentin1-40/+40
Moving the helper to closer where it is used. Cc: Zhang Rui <rui.zhang@intel.com> Cc: linux-pm@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Eduardo Valentin <edubezval@gmail.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2016-11-23thermal: core: move bind_cdev() to where it is usedEduardo Valentin1-38/+38
Moving the helper to closer where it is used. Cc: Zhang Rui <rui.zhang@intel.com> Cc: linux-pm@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Eduardo Valentin <edubezval@gmail.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2016-11-23thermal: core: move __unbind() helper to where it is usedEduardo Valentin1-10/+10
Simply moving the helper to closer where it is actually used. Cc: Zhang Rui <rui.zhang@intel.com> Cc: linux-pm@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Eduardo Valentin <edubezval@gmail.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2016-11-23thermal: core: small style fix on __unbind() helperEduardo Valentin1-1/+1
Simply aligning to parenthesis. Cc: Zhang Rui <rui.zhang@intel.com> Cc: linux-pm@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Eduardo Valentin <edubezval@gmail.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2016-11-23thermal: core: move idr handling to device management sectionEduardo Valentin1-24/+24
Given that idr is only used to get id for thermal devices (zones and cooling), makes sense to move the code closer. Cc: Zhang Rui <rui.zhang@intel.com> Cc: linux-pm@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Eduardo Valentin <edubezval@gmail.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2016-11-23thermal: core: group functions related to governor handlingEduardo Valentin1-73/+80
Organize thermal core code to group the functions handling with governor manipulation in one single section. Cc: Zhang Rui <rui.zhang@intel.com> Cc: linux-pm@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Eduardo Valentin <edubezval@gmail.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2016-11-23thermal: core: introduce thermal_helpers.cEduardo Valentin1-170/+0
Here we have a simple code organization. This patch moves functions that do not need to handle thermal core internal data structure to thermal_helpers.c file. Cc: Zhang Rui <rui.zhang@intel.com> Cc: linux-pm@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Eduardo Valentin <edubezval@gmail.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2016-11-23thermal: core: remove a couple of style issues on helpersEduardo Valentin1-4/+5
Reorganizing the code of helper functions to improve readability and style, as recommended by checkpatch.pl. Cc: Zhang Rui <rui.zhang@intel.com> Cc: linux-pm@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Eduardo Valentin <edubezval@gmail.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2016-11-23thermal: core: move cooling device sysfs to thermal_sysfs.cEduardo Valentin1-127/+1
This is a code reorganization, simply to concentrate the sysfs handling functions in thermal_sysfs.c. This patch moves the cooling device handling functions. Cc: Zhang Rui <rui.zhang@intel.com> Cc: linux-pm@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Eduardo Valentin <edubezval@gmail.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2016-11-23thermal: core: move to_cooling_device macro to header fileEduardo Valentin1-3/+0
Make the to_cooling_device() macro available across files in thermal core. Cc: Zhang Rui <rui.zhang@intel.com> Cc: linux-pm@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Eduardo Valentin <edubezval@gmail.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2016-11-23thermal: core: move thermal_zone sysfs to thermal_sysfs.cEduardo Valentin1-609/+0
This is a code reorganization, simply to concentrate the code handling sysfs in a specific file: thermal_sysfs.c. Right now, moving only the sysfs entries of thermal_zone_device. Cc: Zhang Rui <rui.zhang@intel.com> Cc: linux-pm@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Eduardo Valentin <edubezval@gmail.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2016-11-23thermal: core: match parenthesis on code alignmentEduardo Valentin1-7/+7
Cosmetic change in the sysfs handling functions, as recommended by checkpatch.pl. Cc: Zhang Rui <rui.zhang@intel.com> Cc: linux-pm@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Eduardo Valentin <edubezval@gmail.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2016-11-23thermal: core: treat correctly the return value of *scanf callsEduardo Valentin1-7/+7
This patch checks the return value of all calls to *scanf. The check is to simply match the number of expect inputs. The current code does not do any recovery in case the number of treated inputs are different than the expected. Therefore, keeping the same behavior. Cc: Zhang Rui <rui.zhang@intel.com> Cc: linux-pm@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Eduardo Valentin <edubezval@gmail.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2016-11-23thermal: core: move to_thermal_zone() macro to header fileEduardo Valentin1-3/+0
Simply making this macro available to other thermal core files. Cc: Zhang Rui <rui.zhang@intel.com> Cc: linux-pm@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Eduardo Valentin <edubezval@gmail.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2016-11-23thermal: core: split available_policies_show()Eduardo Valentin1-15/+20
This patch creates a helper to build a list of available governors. Cc: Zhang Rui <rui.zhang@intel.com> Cc: linux-pm@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Eduardo Valentin <edubezval@gmail.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2016-11-23thermal: core: split policy_storeEduardo Valentin1-13/+24
Similarly to passive_store, policy_store now is split between thermal core data structure handling and sysfs handling. Cc: Zhang Rui <rui.zhang@intel.com> Cc: linux-pm@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Eduardo Valentin <edubezval@gmail.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2016-11-23thermal: core: split passive_storeEduardo Valentin1-21/+41
Split passive_store between sysfs handling and thermal core internal data handling. Cc: Zhang Rui <rui.zhang@intel.com> Cc: linux-pm@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Eduardo Valentin <edubezval@gmail.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2016-11-23thermal: core: remove unnecessary device_remove() callsEduardo Valentin1-5/+0
Given that cdevs sysfs properties are already registered using the dev.groups, there is no need to explicitly call device_remove() for each property. Cc: Zhang Rui <rui.zhang@intel.com> Cc: linux-pm@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Eduardo Valentin <edubezval@gmail.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>