Skip to content

Commit

Permalink
PM: domains: Return early if perf state is already set for the device
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Ulf Hansson <[email protected]>
Signed-off-by: Rafael J. Wysocki <[email protected]>
  • Loading branch information
storulf authored and rafaeljw committed Jun 11, 2021
1 parent 0eef091 commit d97fe10
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/base/power/domain.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit d97fe10

Please sign in to comment.