mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-05 02:21:52 +09:00
ANDROID: OPP: Fix incorrectly backported logic in _set_opp_level()
Commitb50a013d33("BACKPORT: OPP: Extend support for the opp-level beyond required-opps") used dev_pm_genpd_set_performance_state() as a substitute for dev_pm_domain_set_performance_state(), since introducing dev_pm_domain_set_performance_state() required breaking the ABI on this branch. However, directly invoking dev_pm_genpd_set_performance_state() is not equivalent to dev_pm_domain_set_performance_state(), as the latter only invokes a PM domain's set_performance_state callback if the device it is invoked on uses a PM domain, and if that PM domain supports that callback. If that check fails, then the invocation is simply a nop, and no error code is returned. In contrast, dev_pm_genpd_set_performance_state() checks to ensure that the device uses a PM domain, and that the PM domain is a generic PM domain. If that is not the case, then the invocation returns an error which is then propagated up the call chain. Therefore, fix _set_opp_level() to function as a nop for devices without PM domains to align it to its original intent. Bug: 394178898 Fixes:b50a013d33("BACKPORT: OPP: Extend support for the opp-level beyond required-opps") Change-Id: I664d45168404d62aecf59a0afcd2e001d6b7a247 Signed-off-by: Isaac J. Manjarres <isaacmanjarres@google.com>
This commit is contained in:
committed by
Isaac Manjarres
parent
1cf6be7092
commit
4033df202b
@@ -1024,11 +1024,18 @@ static int _set_opp_level(struct device *dev, struct opp_table *opp_table,
|
||||
level = opp->level;
|
||||
}
|
||||
|
||||
/* Request a new performance state through the device's PM domain. */
|
||||
ret = dev_pm_genpd_set_performance_state(dev, level);
|
||||
if (ret)
|
||||
dev_err(dev, "Failed to set performance state %u (%d)\n", level,
|
||||
ret);
|
||||
/*
|
||||
* This function should be a nop for devices without a PM domain. However,
|
||||
* dev_pm_genpd_set_performance_state() returns an error for devices without a PM domain
|
||||
* instead of returning immediately.
|
||||
*/
|
||||
if (dev->pm_domain) {
|
||||
/* Request a new performance state through the device's PM domain. */
|
||||
ret = dev_pm_genpd_set_performance_state(dev, level);
|
||||
if (ret)
|
||||
dev_err(dev, "Failed to set performance state %u (%d)\n", level,
|
||||
ret);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user