From fbde18a19c146bdc5063a30987b33920fadb09b2 Mon Sep 17 00:00:00 2001 From: Deepak Nibade Date: Wed, 6 Jan 2016 18:20:57 +0530 Subject: [PATCH] devfreq: get dev status after checking if scaling is enabled In nvhost_pod_estimate_freq(), we currently have below sequence - profile->get_dev_status() - check if (!podgov->enable) - check if (podgov->p_user) But in case we have podgov disabled, we unnecessarily call profile->get_dev_status() Hence, do all such checks before calling get_dev_status() Bug 200161377 Change-Id: I6128803c21bea6c5efefd517ea1c69e4f1b1597e Signed-off-by: Deepak Nibade Reviewed-on: http://git-master/r/929508 Reviewed-on: http://git-master/r/933703 (cherry picked from linux-4.9 commit b8d1d439d206887c3cf4ff50119647b02efdae0e) Reviewed-on: https://git-master.nvidia.com/r/1770135 Reviewed-by: Mikko Perttunen GVS: Gerrit_Virtual_Submit Reviewed-by: Timo Alho Tested-by: Timo Alho Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/devfreq/governor_pod_scaling.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/devfreq/governor_pod_scaling.c b/drivers/devfreq/governor_pod_scaling.c index 0f192970..472647a1 100644 --- a/drivers/devfreq/governor_pod_scaling.c +++ b/drivers/devfreq/governor_pod_scaling.c @@ -729,10 +729,6 @@ static int nvhost_pod_estimate_freq(struct devfreq *df, int stat; ktime_t now; - stat = df->profile->get_dev_status(df->dev.parent, &dev_stat); - if (stat < 0) - return stat; - /* Ensure maximal clock when scaling is disabled */ if (!podgov->enable) { *freq = df->max_freq; @@ -744,6 +740,10 @@ static int nvhost_pod_estimate_freq(struct devfreq *df, return 0; } + stat = df->profile->get_dev_status(df->dev.parent, &dev_stat); + if (stat < 0) + return stat; + if (dev_stat.total_time == 0) { *freq = dev_stat.current_frequency; return 0;