thermal: step_wise: return instance->target by default
authorEduardo Valentin <eduardo.valentin@ti.com>
Mon, 17 Jun 2013 13:24:24 +0000 (21:24 +0800)
committerZhang Rui <rui.zhang@intel.com>
Thu, 15 Aug 2013 07:49:20 +0000 (15:49 +0800)
commitca56caa02182044667b680154a0550ad52726584
treef1044634952b58688c633fdddb8e838c861dfaa6
parent178c2490b99f898efc06d1ad75cadc84f13021a6
thermal: step_wise: return instance->target by default

In case the trend is not changing or when there is no
request for throttling, it is expected that the instance
would not change its requested target. This patch improves
the code implementation to cover for this expected behavior.

With current implementation, the instance will always
reset to cdev.cur_state, even in not expected cases,
like those mentioned above.

This patch changes the step_wise governor implementation
of get_target so that we accomplish:
(a) - default value will be current instance->target, so
we do not change the thermal instance target unnecessarily.
(b) - the code now it is clear about what is the intention.
There is a clear statement of what are the expected outcomes
(c) - removal of hardcoded constants, now it is put in use
the THERMAL_NO_TARGET macro.
(d) - variable names are also improved so that reader can
clearly understand the difference between instance cur target,
next target and cdev cur_state.

Cc: Zhang Rui <rui.zhang@intel.com>
Cc: Durgadoss R <durgadoss.r@intel.com>
Cc: linux-pm@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Reported-by: Ruslan Ruslichenko <ruslan.ruslichenko@ti.com>
Signed-of-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
drivers/thermal/step_wise.c