summaryrefslogtreecommitdiffstats
path: root/drivers/base/power
diff options
context:
space:
mode:
authorUlf Hansson <ulf.hansson@linaro.org>2021-06-03 11:34:36 +0200
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2021-06-11 18:39:24 +0200
commitd97fe100ee0b36c5dd8013ffd70fe8fcdcabff2b (patch)
tree76e151367dac89e324c223ce9cd94ebeb2138aa5 /drivers/base/power
parentPM: domains: Split code in dev_pm_genpd_set_performance_state() (diff)
downloadlinux-d97fe100ee0b36c5dd8013ffd70fe8fcdcabff2b.tar.xz
linux-d97fe100ee0b36c5dd8013ffd70fe8fcdcabff2b.zip
PM: domains: Return early if perf state is already set for the device
When dev_pm_genpd_set_performance_state() gets called to set a new performance state for the device, let's take a quicker path by doing an early return, if it turns out that the new state is already set for the device. Suggested-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/base/power')
-rw-r--r--drivers/base/power/domain.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
index ede0f576efe6..90a9828fcb2f 100644
--- a/drivers/base/power/domain.c
+++ b/drivers/base/power/domain.c
@@ -387,6 +387,9 @@ static int genpd_set_performance_state(struct device *dev, unsigned int state)
int ret;
prev_state = gpd_data->performance_state;
+ if (prev_state == state)
+ return 0;
+
gpd_data->performance_state = state;
state = _genpd_reeval_performance_state(genpd, state);