Skip to content

Commit c0006dc

Browse files
committed
Merge tag 'pm-5.14-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
Pull power management fixes from Rafael Wysocki: "These fix two issues introduced during this cycle, one of which is a regression and the other one affects new code. Specifics: - Prevent the operating performance points (OPP) code from crashing when some entries in the table of required OPPs are set to error pointer values (Marijn Suijten) - Prevent the generic power domains (genpd) framework from incorrectly overriding the performance state of a device set by its driver while it is runtime-suspended or when runtime PM of it is disabled (Dmitry Osipenko)" * tag 'pm-5.14-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: PM: domains: Improve runtime PM performance state handling opp: core: Check for pending links before reading required_opp pointers
2 parents 425bec0 + 7ee5fd1 commit c0006dc

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

drivers/base/power/domain.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,7 @@ static void genpd_restore_performance_state(struct device *dev,
435435
int dev_pm_genpd_set_performance_state(struct device *dev, unsigned int state)
436436
{
437437
struct generic_pm_domain *genpd;
438-
int ret;
438+
int ret = 0;
439439

440440
genpd = dev_to_genpd_safe(dev);
441441
if (!genpd)
@@ -446,7 +446,13 @@ int dev_pm_genpd_set_performance_state(struct device *dev, unsigned int state)
446446
return -EINVAL;
447447

448448
genpd_lock(genpd);
449-
ret = genpd_set_performance_state(dev, state);
449+
if (pm_runtime_suspended(dev)) {
450+
dev_gpd_data(dev)->rpm_pstate = state;
451+
} else {
452+
ret = genpd_set_performance_state(dev, state);
453+
if (!ret)
454+
dev_gpd_data(dev)->rpm_pstate = 0;
455+
}
450456
genpd_unlock(genpd);
451457

452458
return ret;

drivers/opp/core.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -893,6 +893,10 @@ static int _set_required_opps(struct device *dev,
893893
if (!required_opp_tables)
894894
return 0;
895895

896+
/* required-opps not fully initialized yet */
897+
if (lazy_linking_pending(opp_table))
898+
return -EBUSY;
899+
896900
/*
897901
* We only support genpd's OPPs in the "required-opps" for now, as we
898902
* don't know much about other use cases. Error out if the required OPP
@@ -903,10 +907,6 @@ static int _set_required_opps(struct device *dev,
903907
return -ENOENT;
904908
}
905909

906-
/* required-opps not fully initialized yet */
907-
if (lazy_linking_pending(opp_table))
908-
return -EBUSY;
909-
910910
/* Single genpd case */
911911
if (!genpd_virt_devs)
912912
return _set_required_opp(dev, dev, opp, 0);

0 commit comments

Comments
 (0)