thermal: fix cpu_cooling max_level behavior
authorEduardo Valentin <eduardo.valentin@ti.com>
Wed, 13 Nov 2013 18:11:09 +0000 (14:11 -0400)
committerAlex Shi <alex.shi@linaro.org>
Thu, 25 Sep 2014 09:02:15 +0000 (17:02 +0800)
commite86c742e299cbe321870aa00bcbd4985d1f628fe
tree6ae40faa730cfafab518cd266ae95ce1e87a2e4d
parentd05bc7105a1b8f6df6569b7c1a89a2fe466f8688
thermal: fix cpu_cooling max_level behavior

As per Documentation/thermal/sysfs-api.txt, max_level
is an index, not a counter. Thus, in case a CPU has
3 valid frequencies, max_level is expected to be 2, for instance.

The current code makes max_level == number of valid frequencies,
which is bogus. This patch fix the cpu_cooling device by
ranging max_level properly.

Reported-by: Carlos Hernandez <ceh@ti.com>
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
(cherry picked from commit 1c9573a40c1d34494419f32560f28c763c504d79)
Signed-off-by: Alex Shi <alex.shi@linaro.org>
drivers/thermal/cpu_cooling.c