summaryrefslogtreecommitdiffstats
path: root/drivers/devfreq
diff options
context:
space:
mode:
authorSaravana Kannan <saravanak@google.com>2021-02-04 16:14:23 +0800
committerViresh Kumar <viresh.kumar@linaro.org>2021-02-04 16:36:28 +0530
commit26f9c7cc42a6dc036edf871544fd0e6b3a0601c1 (patch)
tree57c971b834230ed04a3d15e41d2aee94412d50b7 /drivers/devfreq
parent7d8658ef65a4f891d0cff6340fa717b378384642 (diff)
downloadlinux-26f9c7cc42a6dc036edf871544fd0e6b3a0601c1.tar.gz
linux-26f9c7cc42a6dc036edf871544fd0e6b3a0601c1.tar.bz2
linux-26f9c7cc42a6dc036edf871544fd0e6b3a0601c1.zip
PM / devfreq: Cache OPP table reference in devfreq
The OPP table can be used often in devfreq. Trying to get it each time can be expensive, so cache it in the devfreq struct. Signed-off-by: Saravana Kannan <saravanak@google.com> Acked-by: MyungJoo Ham <myungjoo.ham@samsung.com> Acked-by: Chanwoo Choi <cw00.choi@samsung.com> Signed-off-by: Hsin-Yi Wang <hsinyi@chromium.org> [ Viresh: Added a blank line ] Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Diffstat (limited to 'drivers/devfreq')
-rw-r--r--drivers/devfreq/devfreq.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c
index 6aa10de792b3..cefe84a10824 100644
--- a/drivers/devfreq/devfreq.c
+++ b/drivers/devfreq/devfreq.c
@@ -757,6 +757,9 @@ static void devfreq_dev_release(struct device *dev)
if (devfreq->profile->exit)
devfreq->profile->exit(devfreq->dev.parent);
+ if (devfreq->opp_table)
+ dev_pm_opp_put_opp_table(devfreq->opp_table);
+
mutex_destroy(&devfreq->lock);
kfree(devfreq);
}
@@ -844,6 +847,10 @@ struct devfreq *devfreq_add_device(struct device *dev,
}
devfreq->suspend_freq = dev_pm_opp_get_suspend_opp_freq(dev);
+ devfreq->opp_table = dev_pm_opp_get_opp_table(dev);
+ if (IS_ERR(devfreq->opp_table))
+ devfreq->opp_table = NULL;
+
atomic_set(&devfreq->suspend_count, 0);
dev_set_name(&devfreq->dev, "%s", dev_name(dev));