staging: ti-soc-thermal: return error in case power switch is not supported

Improve ti_bandgap_power by returning an error code in case
the device does not support controlling its power state.

Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Eduardo Valentin 2013-04-01 12:04:33 -04:00 committed by Greg Kroah-Hartman
parent af56976dd2
commit 422a306380
1 changed files with 5 additions and 3 deletions

View File

@ -100,17 +100,19 @@ do { \
*/ */
static int ti_bandgap_power(struct ti_bandgap *bgp, bool on) static int ti_bandgap_power(struct ti_bandgap *bgp, bool on)
{ {
int i; int i, ret = 0;
if (!TI_BANDGAP_HAS(bgp, POWER_SWITCH)) if (!TI_BANDGAP_HAS(bgp, POWER_SWITCH)) {
ret = -ENOTSUPP;
goto exit; goto exit;
}
for (i = 0; i < bgp->conf->sensor_count; i++) for (i = 0; i < bgp->conf->sensor_count; i++)
/* active on 0 */ /* active on 0 */
RMW_BITS(bgp, i, temp_sensor_ctrl, bgap_tempsoff_mask, !on); RMW_BITS(bgp, i, temp_sensor_ctrl, bgap_tempsoff_mask, !on);
exit: exit:
return 0; return ret;
} }
/** /**