diff mbox

[13/18] thermal: exynos: set trips in ascending order in exynos7_tmu_initialize()

Message ID 1524743493-28113-14-git-send-email-b.zolnierkie@samsung.com (mailing list archive)
State Accepted
Delegated to: Eduardo Valentin
Headers show

Commit Message

Bartlomiej Zolnierkiewicz April 26, 2018, 11:51 a.m. UTC
Set trips in ascending order in exynos7_tmu_initialize() (it should
make no difference in driver operation). This prepares the driver
code to moving trips setting from ->tmu_initialize method to
exynos_tmu_initialize().

Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
---
 drivers/thermal/samsung/exynos_tmu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Daniel Lezcano May 1, 2018, 10:02 a.m. UTC | #1
On Thu, Apr 26, 2018 at 01:51:28PM +0200, Bartlomiej Zolnierkiewicz wrote:
> Set trips in ascending order in exynos7_tmu_initialize() (it should
> make no difference in driver operation). This prepares the driver
> code to moving trips setting from ->tmu_initialize method to
> exynos_tmu_initialize().
> 
> Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
> ---
>  drivers/thermal/samsung/exynos_tmu.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c
> index 12b60e2..571511f 100644
> --- a/drivers/thermal/samsung/exynos_tmu.c
> +++ b/drivers/thermal/samsung/exynos_tmu.c
> @@ -618,7 +618,7 @@ static void exynos7_tmu_initialize(struct platform_device *pdev)
>  	sanitize_temp_error(data, trim_info);
>  
>  	/* Write temperature code for rising and falling threshold */
> -	for (i = (of_thermal_get_ntrips(tz) - 1); i >= 0; i--) {
> +	for (i = 0; i < of_thermal_get_ntrips(tz); i++) {

Capped with data->ntrip ?

>  		tz->ops->get_trip_temp(tz, i, &temp);
>  		temp /= MCELSIUS;
>  		exynos7_tmu_set_trip_temp(data, i, temp);
> -- 
> 1.9.1
>
Bartlomiej Zolnierkiewicz May 2, 2018, 9:37 a.m. UTC | #2
On Tuesday, May 01, 2018 12:02:42 PM Daniel Lezcano wrote:
> On Thu, Apr 26, 2018 at 01:51:28PM +0200, Bartlomiej Zolnierkiewicz wrote:
> > Set trips in ascending order in exynos7_tmu_initialize() (it should
> > make no difference in driver operation). This prepares the driver
> > code to moving trips setting from ->tmu_initialize method to
> > exynos_tmu_initialize().
> > 
> > Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
> > ---
> >  drivers/thermal/samsung/exynos_tmu.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c
> > index 12b60e2..571511f 100644
> > --- a/drivers/thermal/samsung/exynos_tmu.c
> > +++ b/drivers/thermal/samsung/exynos_tmu.c
> > @@ -618,7 +618,7 @@ static void exynos7_tmu_initialize(struct platform_device *pdev)
> >  	sanitize_temp_error(data, trim_info);
> >  
> >  	/* Write temperature code for rising and falling threshold */
> > -	for (i = (of_thermal_get_ntrips(tz) - 1); i >= 0; i--) {
> > +	for (i = 0; i < of_thermal_get_ntrips(tz); i++) {
> 
> Capped with data->ntrip ?

No need to, the code in question is removed in patch #14 (also Exynos7
DTS doesn't define more trip points than data->ntrip).

> >  		tz->ops->get_trip_temp(tz, i, &temp);
> >  		temp /= MCELSIUS;
> >  		exynos7_tmu_set_trip_temp(data, i, temp);

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics
diff mbox

Patch

diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c
index 12b60e2..571511f 100644
--- a/drivers/thermal/samsung/exynos_tmu.c
+++ b/drivers/thermal/samsung/exynos_tmu.c
@@ -618,7 +618,7 @@  static void exynos7_tmu_initialize(struct platform_device *pdev)
 	sanitize_temp_error(data, trim_info);
 
 	/* Write temperature code for rising and falling threshold */
-	for (i = (of_thermal_get_ntrips(tz) - 1); i >= 0; i--) {
+	for (i = 0; i < of_thermal_get_ntrips(tz); i++) {
 		tz->ops->get_trip_temp(tz, i, &temp);
 		temp /= MCELSIUS;
 		exynos7_tmu_set_trip_temp(data, i, temp);