summaryrefslogtreecommitdiff
path: root/drivers/opp
diff options
context:
space:
mode:
authorViresh Kumar <viresh.kumar@linaro.org>2020-05-15 12:37:24 +0530
committerViresh Kumar <viresh.kumar@linaro.org>2020-05-29 10:15:12 +0530
commitb23dfa3543f31fbb8c0098925bf90fc23193d17a (patch)
treef9a9fc56a04dd4d6d253855a9b5631ac123a7510 /drivers/opp
parent0430b1d5704b0f0f1d237236dde9c143f8669e49 (diff)
downloadlwn-b23dfa3543f31fbb8c0098925bf90fc23193d17a.tar.gz
lwn-b23dfa3543f31fbb8c0098925bf90fc23193d17a.zip
opp: Reorder the code for !target_freq case
Reorder the code a bit to make it more readable. Add additional comment as well. Tested-by: Marek Szyprowski <m.szyprowski@samsung.com> Acked-by: Clément Péron <peron.clem@gmail.com> Tested-by: Clément Péron <peron.clem@gmail.com> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Diffstat (limited to 'drivers/opp')
-rw-r--r--drivers/opp/core.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/drivers/opp/core.c b/drivers/opp/core.c
index c3ce39c74de8..5e1035a041ae 100644
--- a/drivers/opp/core.c
+++ b/drivers/opp/core.c
@@ -817,15 +817,21 @@ int dev_pm_opp_set_rate(struct device *dev, unsigned long target_freq)
}
if (unlikely(!target_freq)) {
- if (opp_table->required_opp_tables) {
- ret = _set_required_opps(dev, opp_table, NULL);
- } else if (!_get_opp_count(opp_table)) {
+ /*
+ * Some drivers need to support cases where some platforms may
+ * have OPP table for the device, while others don't and
+ * opp_set_rate() just needs to behave like clk_set_rate().
+ */
+ if (!_get_opp_count(opp_table))
return 0;
- } else {
+
+ if (!opp_table->required_opp_tables) {
dev_err(dev, "target frequency can't be 0\n");
ret = -EINVAL;
+ goto put_opp_table;
}
+ ret = _set_required_opps(dev, opp_table, NULL);
goto put_opp_table;
}