Commit graph

265 commits

Author SHA1 Message Date
Steven Rostedt ace120dcf2 Thermal: Fix lockup of cpu_down()
Commit f1a18a105 "Thermal: CPU Package temperature thermal" had code
that did a get_online_cpus(), run a loop and then do a
put_online_cpus(). The problem is that the loop had an error exit that
would skip the put_online_cpus() part.

In the error exit part of the function, it also did a get_online_cpus(),
run a loop and then put_online_cpus(). The only way to get to the error
exit part is with get_online_cpus() already performed. If this error
condition is hit, the system will be prevented from taking CPUs offline.
The process taking the CPU offline will lock up hard.

Removing the get_online_cpus() removes the lockup as the hotplug CPU
refcount is back to zero.

This was bisected with ktest.

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2013-07-22 09:34:46 +08:00
Srinivas Pandruvada 94e791f522 Thermal: x86_pkg_temp: Limit number of pkg temp zones
Although it is unlikley that physical package id is set to some
arbitary number, it is better to prevent in anycase. Since package
temp zones use this in thermal zone type and for allocation, added
a limit.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2013-07-16 08:27:25 +08:00
Wei Yongjun c7c1b3112e Thermal: x86_pkg_temp: fix krealloc() misuse in in pkg_temp_thermal_device_add()
If krealloc() returns NULL, it doesn't free the original. So any code
of the form 'foo = krealloc(foo, ...);' is almost certainly a bug.

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2013-07-15 16:26:33 +08:00
Srinivas Pandruvada f3ed0a17f0 Thermal: x86 package temp thermal crash
On systems with no package MSR support this caused crash as there
is a bug in the logic to check presence of DTHERM and PTS feature
together. Added a change so that when there is no PTS support, module
doesn't get loaded. Even if some CPU comes online with the PTS
feature disabled, and other CPUs has this support, this patch
will still prevent such MSR accesses.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Reported-by: Daniel Walker <dwalker@fifo99.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2013-07-15 16:20:58 +08:00
Linus Torvalds 8cbd0eefca Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux
Pull thermal management updates from Zhang Rui:
 "There are not too many changes this time, except two new platform
  thermal drivers, ti-soc-thermal driver and x86_pkg_temp_thermal
  driver, and a couple of small fixes.

  Highlights:

   - move the ti-soc-thermal driver out of the staging tree to the
     thermal tree.

   - introduce the x86_pkg_temp_thermal driver.  This driver registers
     CPU digital temperature package level sensor as a thermal zone.

   - small fixes/cleanups including removing redundant use of
     platform_set_drvdata() and of_match_ptr for all platform thermal
     drivers"

* 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux: (34 commits)
  thermal: cpu_cooling: fix stub function
  thermal: ti-soc-thermal: use standard GPIO DT bindings
  thermal: MAINTAINERS: Add git tree path for SoC specific updates
  thermal: fix x86_pkg_temp_thermal.c build and Kconfig
  Thermal: Documentation for x86 package temperature thermal driver
  Thermal: CPU Package temperature thermal
  thermal: consider emul_temperature while computing trend
  thermal: ti-soc-thermal: add DT example for DRA752 chip
  thermal: ti-soc-thermal: add dra752 chip to device table
  thermal: ti-soc-thermal: add thermal data for DRA752 chips
  thermal: ti-soc-thermal: remove usage of IS_ERR_OR_NULL
  thermal: ti-soc-thermal: freeze FSM while computing trend
  thermal: ti-soc-thermal: remove external heat while extrapolating hotspot
  thermal: ti-soc-thermal: update DT reference for OMAP5430
  x86, mcheck, therm_throt: Process package thresholds
  thermal: cpu_cooling: fix 'descend' check in get_property()
  Thermal: spear: Remove redundant use of of_match_ptr
  Thermal: kirkwood: Remove redundant use of of_match_ptr
  Thermal: dove: Remove redundant use of of_match_ptr
  Thermal: armada: Remove redundant use of of_match_ptr
  ...
2013-07-11 12:26:08 -07:00
Eduardo Valentin 57d1617137 thermal: ti-soc-thermal: use standard GPIO DT bindings
This change updates the ti-soc-thermal driver to use
standard GPIO DT bindings to read the GPIO number associated
to thermal shutdown IRQ, in case the device features it.

Previously, the code was using a specific DT bindings.
As now OMAP supports the standard way to model GPIOs,
there is no point in having a ti specific binding.

Cc: Zhang Rui <rui.zhang@intel.com>
Cc: Grant Likely <grant.likely@linaro.org>
Cc: Rob Herring <rob.herring@calxeda.com>
Cc: linux-pm@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: devicetree-discuss@lists.ozlabs.org
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
2013-07-08 10:11:59 -04:00
Tomasz Figa 08a763a3e2 thermal: exynos: Support both EXYNOS4X12 SoCs
EXYNOS4212 and EXYNOS4412 have the same thermal block, so there is no
reason to include support only for EXYNOS4412 in this driver.

Cc: linux-pm@vger.kernel.org
Cc: Zhang Rui <rui.zhang@intel.com>
Cc: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Tomasz Figa <t.figa@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
2013-06-19 01:31:50 +09:00
Zhang Rui 9d1968fdab Merge branch 'cpu-package-thermal' of .git into next 2013-06-18 07:26:49 +08:00
Randy Dunlap b3ba020652 thermal: fix x86_pkg_temp_thermal.c build and Kconfig
Fix build error in x86_pkg_temp_thermal.c.  It requires that
X86_MCE & X86_THERMAL_VECTOR be enabled, so depend on the latter symbol,
since it depends on X86_MCE (indirectly).

Also, X86_PKG_TEMP_THERMAL is already inside an "if THERMAL" block,
so remove that duplicated dependency.

ERROR: "platform_thermal_package_rate_control" [drivers/thermal/x86_pkg_temp_thermal.ko] undefined!
ERROR: "platform_thermal_package_notify" [drivers/thermal/x86_pkg_temp_thermal.ko] undefined!

Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Acked-by: Borislav Petkov <bp@suse.de>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2013-06-18 07:26:24 +08:00
Zhang Rui f157f5964b Merge branch 'cpu-package-thermal' of .git into next
Conflicts:
	drivers/thermal/Kconfig
	drivers/thermal/Makefile
2013-06-18 06:31:26 +08:00
Srinivas Pandruvada f1a18a1056 Thermal: CPU Package temperature thermal
This driver register CPU digital temperature sensor as a thermal
zone at package level.
Each package will show up as one zone with at max two trip points.
These trip points can be both read and updated. Once a non zero
value is set in the trip point, if the package package temperature
goes above or below this setting, a thermal notification is
generated.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2013-06-18 06:27:47 +08:00
Zhang Rui 30072fb91e Merge branches 'for-rc' and 'ti-soc' of .git into next 2013-06-13 11:19:36 +08:00
Eduardo Valentin 0c872507d8 thermal: consider emul_temperature while computing trend
In case emulated temperature is in use, using the trend
provided by driver layer can lead to bogus situation.
In this case, debugger user would set a temperature value,
but the trend would be from driver computation.

To avoid this situation, this patch changes the get_tz_trend()
to consider the emulated temperature whenever that is in use.

Cc: Zhang Rui <rui.zhang@intel.com>
Cc: Amit Daniel Kachhap <amit.daniel@samsung.com>
Cc: Durgadoss R <durgadoss.r@intel.com>
Cc: linux-pm@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2013-06-13 10:29:28 +08:00
Eduardo Valentin 25870e6234 thermal: ti-soc-thermal: add dra752 chip to device table
Add support to TI dra752 chips by adapting the driver
device table.

Cc: Zhang Rui <rui.zhang@intel.com>
Cc: linux-pm@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2013-06-13 10:16:07 +08:00
Eduardo Valentin 8926fa4f9b thermal: ti-soc-thermal: add thermal data for DRA752 chips
This patch adds the thermal data for TI DRA752 chips.
In this change it includes (autogen):
. Register offset definitions
. Bitfields and masks for all registers
. Conversion table

Also, the thermal limits, thresholds and extrapolation
rules are included. The extrapolation rule is simply
add +2C as margin.

All 5 sensors, MPU, GPU, CORE, DSPEVE and IVA, are defined
and exposed. Only MPU has cooling 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 <eduardo.valentin@ti.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2013-06-13 10:15:52 +08:00
Eduardo Valentin 0c12b5ac82 thermal: ti-soc-thermal: remove usage of IS_ERR_OR_NULL
This patch changes the driver to avoid the usage of IS_ERR_OR_NULL()
macro. This macro can lead to dangerous results, like returning
success (0) during a failure scenario (NULL pointer handling).

For this reason this patch is changing the driver after
revisiting the code. These are the cases:
i. For cases in which IS_ERR_OR_NULL() is used for checking
return values of functions that returns either PTR_ERR()
or a valid pointer, it has been translated to IS_ERR() check only.
ii. For cases that a NULL check is still needed, it has been
translated to if (!ptr || IS_ERR(ptr)).

Cc: Zhang Rui <rui.zhang@intel.com>
Cc: linux-pm@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2013-06-13 10:14:00 +08:00
Eduardo Valentin ba0049eacc thermal: ti-soc-thermal: freeze FSM while computing trend
In order to read the history buffer, it is required to
freeze BG FSM. This patch adds the missing piece of code
to freeze the FSM and also a contention area to avoid
other parts of the code to access the DTEMPs.

Cc: Zhang Rui <rui.zhang@intel.com>
Cc: linux-pm@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2013-06-13 10:13:52 +08:00
Eduardo Valentin 359836e1de thermal: ti-soc-thermal: remove external heat while extrapolating hotspot
For boards that provide a PCB sensor close to SoC junction
temperature, it is possible to remove the cumulative heat
reported by the SoC temperature sensor.

This patch changes the extrapolation computation to consider
an external sensor in the extrapolation equations.

Cc: Zhang Rui <rui.zhang@intel.com>
Cc: linux-pm@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2013-06-13 10:12:22 +08:00
Shawn Guo 24c7a38172 thermal: cpu_cooling: fix 'descend' check in get_property()
The variable 'descend' is initialized as -1 in function get_property(),
and will never get any chance to be updated by the following code.

	if (freq != CPUFREQ_ENTRY_INVALID && descend != -1)
		descend = !!(freq > table[i].frequency);

This makes function get_property() return the wrong frequency for given
cooling level if the frequency table is sorted in ascending.  Fix it
by correcting the 'descend' check in if-condition to 'descend == -1'.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2013-05-28 14:49:31 +08:00
Zhang Rui e7cd7886ef Merge branches 'misc', 'drv_cleanup', 'devm-cleanup' and 'ti-soc' of .git into next 2013-05-28 10:46:46 +08:00
Sachin Kamat 5454f211dd Thermal: spear: Remove redundant use of of_match_ptr
'spear_thermal_id_table' is always compiled in and the driver
is dependent on OF. Hence use of of_match_ptr is unnecessary.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Cc: Vincenzo Frascino <vincenzo.frascino@st.com>
Cc: Viresh Kumar <viresh.kumar@linaro.org>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Acked-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2013-05-28 10:45:35 +08:00
Sachin Kamat 90c3194e47 Thermal: kirkwood: Remove redundant use of of_match_ptr
'kirkwood_thermal_id_table' is always compiled in and the driver
is dependent on OF. Hence use of of_match_ptr is unnecessary.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Acked-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2013-05-28 10:45:33 +08:00
Sachin Kamat e0d68afa92 Thermal: dove: Remove redundant use of of_match_ptr
'dove_thermal_id_table' is always compiled in and the driver
is dependent on OF. Hence use of of_match_ptr is unnecessary.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Cc: Andrew Lunn <andrew@lunn.ch>
Acked-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2013-05-28 10:45:14 +08:00
Sachin Kamat 1d089e0993 Thermal: armada: Remove redundant use of of_match_ptr
'armada_thermal_id_table' is always compiled in and the driver
is dependent on OF. Hence use of of_match_ptr is unnecessary.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Cc: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
Acked-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2013-05-28 10:44:48 +08:00
Eduardo Valentin eb982001db thermal: introduce TI SoC thermal driver
This patch moves the ti-soc-thermal driver out of
the staging tree to the thermal tree.

Cc: Grant Likely <grant.likely@linaro.org>
Cc: Rob Herring <rob.herring@calxeda.com>
Cc: Rob Landley <rob@landley.net>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Zhang Rui <rui.zhang@intel.com>
Cc: Eduardo Valentin <eduardo.valentin@ti.com>
Cc: J Keerthy <j-keerthy@ti.com>
Cc: Radhesh Fadnis <radhesh.fadnis@ti.com>
Cc: Cyril Roelandt <tipecaml@gmail.com>
Cc: devicetree-discuss@lists.ozlabs.org
Cc: linux-doc@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: devel@driverdev.osuosl.org
Cc: linux-pm@vger.kernel.org
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2013-05-28 10:40:37 +08:00
Zhang Rui c21bec86b6 Thermal: don't check resource with devm_ioremap_resource
devm_ioremap_resource does sanity checks on the given resource.
No need to duplicate this in the driver.

CC: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
CC: Vincenzo Frascino <vincenzo.frascino@st.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
Acked-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
2013-05-28 10:11:02 +08:00
Jonghwa Lee 83720d0b79 Thermal: core: Ask .get_trip_temp() to register thermal zone device.
This patch adds a requirement needing .get_trip_temp() callback
function for registering thermal zone device. This function is
used when thermal zone is updated and essential where thermal core
handles thermal trip based only polling way not hw interrupt.

Signed-off-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
Acked-by: Durgadoss R <durgadoss.r@intel.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2013-05-28 10:04:22 +08:00
Andy Shevchenko 42a5bf507d thermal: cut the spaces when user sets policy
Setting policy results in invalid value error.
	% echo "step_wise" > policy
	% echo: write error: Invalid argument

Need clean up of the buffer which "echo" may add based on the arguments, before
comparing aganist list of governor names.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reported-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Acked-by: Eduardo Valentin <eduardo.valentin@ti.com>
Tested-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2013-05-28 10:04:22 +08:00
Laurent Pinchart 3db46c9396 thermal: rcar: Fix typo in probe information message
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Acked-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2013-05-28 10:04:21 +08:00
Zhang Rui 253e3ae170 Thermal: spear_thermal: convert to devm_ioremap_resource
Use the newly introduced devm_ioremap_resource().

devm_ioremap_resource() provides its own error messages; so all explicit
error messages can be removed from the failure code paths.

CC: Vincenzo Frascino <vincenzo.frascino@st.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2013-05-20 23:36:18 +08:00
Wolfram Sang c28f692c6f drivers/thermal: don't check resource with devm_ioremap_resource
devm_ioremap_resource does sanity checks on the given resource. No need to
duplicate this in the driver.

Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Acked-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2013-05-20 23:35:52 +08:00
Wolfram Sang b948cc6161 drivers/thermal: don't check resource with devm_ioremap_resource
devm_ioremap_resource does sanity checks on the given resource. No need to
duplicate this in the driver.

Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2013-05-18 11:57:30 +02:00
Sachin Kamat a1cf1150f1 Thermal: spear: Remove redundant platform_set_drvdata()
Commit 0998d06310 (device-core: Ensure drvdata = NULL when no
driver is bound) removes the need to set driver data field to
NULL.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Cc: Vincenzo Frascino <vincenzo.frascino@st.com>
Acked-by: Eduardo Valentin <eduardo.valentin@ti.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2013-05-06 22:37:32 +08:00
Sachin Kamat 6135ba36f4 Thermal: rcar: Remove redundant platform_set_drvdata()
Commit 0998d06310 (device-core: Ensure drvdata = NULL when no
driver is bound) removes the need to set driver data field to
NULL.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Cc: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Acked-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2013-05-06 22:37:30 +08:00
Sachin Kamat 0f3913bd2d Thermal: kirkwood: Remove redundant platform_set_drvdata()
Commit 0998d06310 (device-core: Ensure drvdata = NULL when no
driver is bound) removes the need to set driver data field to
NULL.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Cc: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Acked-by: Eduardo Valentin <eduardo.valentin@ti.com>
Acked-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2013-05-06 22:37:04 +08:00
Sachin Kamat a2071b0b44 Thermal: exynos: Remove redundant platform_set_drvdata()
Commit 0998d06310 (device-core: Ensure drvdata = NULL when no
driver is bound) removes the need to set driver data field to
NULL.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Acked-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2013-05-06 22:37:02 +08:00
Sachin Kamat aa50c4e49c Thermal: dove_thermal: Remove redundant platform_set_drvdata()
Commit 0998d06310 (device-core: Ensure drvdata = NULL when no
driver is bound) removes the need to set driver data field to
NULL.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Cc: Andrew Lunn <andrew@lunn.ch>
Acked-by: Andrew Lunn <andrew@lunn.ch>
Acked-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2013-05-06 22:37:00 +08:00
Sachin Kamat 2a456cfbdb Thermal: armada_thermal: Remove redundant platform_set_drvdata()
Commit 0998d06310 (device-core: Ensure drvdata = NULL when no
driver is bound) removes the need to set driver data field to
NULL.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Cc: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
Acked-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
Acked-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2013-05-06 22:36:55 +08:00
Zhang Rui 8f578bfefd Merge branch 'cpu_cooling-doc-comments-update' of .git into next 2013-04-27 09:28:56 +08:00
Eduardo Valentin 70d23b29e4 thermal: db8500_cpufreq_cooling: remove usage of IS_ERR_OR_NULL()
This patch changes the driver to avoid the usage of IS_ERR_OR_NULL()
macro. This macro can lead to dangerous results, like returning
success (0) during a failure scenario (NULL pointer handling).

The case present in this driver can be translated to a simple
check for IS_ERR(), as the cpufreq_cooling_register() returns
either a valid pointer or an ERR_PTR().

Cc: Zhang Rui <rui.zhang@intel.com>
Cc: Russell King <rmk@arm.linux.org.uk>
Cc: Grant Likely <grant.likely@secretlab.ca>
Cc: Rob Herring <rob.herring@calxeda.com>
Cc: Hongbo Zhang <hongbo.zhang@stericsson.com>
Cc: linux-pm@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: devicetree-discuss@lists.ozlabs.org
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Acked-by: Fabio Baltieri <fabio.baltieri@linaro.org>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2013-04-27 09:28:38 +08:00
Eduardo Valentin 9b19ec39b0 thermal: thermal_core: remove usage of IS_ERR_OR_NULL
This patch changes the driver to avoid the usage of IS_ERR_OR_NULL()
macro. This macro can lead to dangerous results, like returning
success (0) during a failure scenario (NULL pointer handling).

The case present in this patch has simply be translated to
normal check for NULL and if the pointer has an error code.
The later case is needed because functions like
thermal_zone_get_zone_by_name() could return an ERR_PTR().

Cc: Zhang Rui <rui.zhang@intel.com>
Cc: Russell King <rmk@arm.linux.org.uk>
Cc: linux-pm@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2013-04-27 09:28:25 +08:00
Eduardo Valentin 5fda7f680a thermal: cpu_cooling: alignment improvements
Improve code readiness by changing alignments so that
they match open parenthesis, like checkpatch.pl --strict
suggests.

Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2013-04-27 09:25:55 +08:00
Eduardo Valentin ef5e2124ec thermal: cpu_cooling: remove checkpatch.pl warning
Simple code style fix.

Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2013-04-27 09:25:51 +08:00
Eduardo Valentin e45a643002 thermal: cpu_cooling: remove trailing blank line
Remove unnecessary blank line.

Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2013-04-27 09:25:47 +08:00
Eduardo Valentin d8892a01b1 thermal: cpu_cooling: align on open parenthesis
Improve code readiness by remove checkpatch.pl warnings
on get_property function.

Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2013-04-27 09:25:43 +08:00
Eduardo Valentin 1b9e352659 thermal: cpu_cooling: standardize comment style
There are at least three patterns for oneline comments in this
file. This patch changes them to one single pattern

Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2013-04-27 09:25:38 +08:00
Eduardo Valentin 79491e53dc thermal: cpu_cooling: standardize end of function
Just for code readiness, this patch makes all functions
on this file to have a blank line before their returns.
Now, some functions follow this pattern, and others will
not have a blank line. So, this patch makes it a single
pattern.

Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2013-04-27 09:25:32 +08:00
Eduardo Valentin 79d264016a thermal: cpu_cooling: remove trailing white spaces
Remove unnecessary white spaces.

Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2013-04-27 09:25:24 +08:00
Zhang Rui 07273d25b8 Merge branch 'cpu_cooling-doc-comments-update' of .git into next 2013-04-25 00:57:37 +08:00
Zhang Rui eea2d4812d Merge branch 'thermal_core-doc-comments-update' of .git into next 2013-04-25 00:57:22 +08:00