Skip to content

Commit b23dfa3

Browse files
committed
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 <[email protected]> Acked-by: Clément Péron <[email protected]> Tested-by: Clément Péron <[email protected]> Signed-off-by: Viresh Kumar <[email protected]>
1 parent 0430b1d commit b23dfa3

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

drivers/opp/core.c

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -817,15 +817,21 @@ int dev_pm_opp_set_rate(struct device *dev, unsigned long target_freq)
817817
}
818818

819819
if (unlikely(!target_freq)) {
820-
if (opp_table->required_opp_tables) {
821-
ret = _set_required_opps(dev, opp_table, NULL);
822-
} else if (!_get_opp_count(opp_table)) {
820+
/*
821+
* Some drivers need to support cases where some platforms may
822+
* have OPP table for the device, while others don't and
823+
* opp_set_rate() just needs to behave like clk_set_rate().
824+
*/
825+
if (!_get_opp_count(opp_table))
823826
return 0;
824-
} else {
827+
828+
if (!opp_table->required_opp_tables) {
825829
dev_err(dev, "target frequency can't be 0\n");
826830
ret = -EINVAL;
831+
goto put_opp_table;
827832
}
828833

834+
ret = _set_required_opps(dev, opp_table, NULL);
829835
goto put_opp_table;
830836
}
831837

0 commit comments

Comments
 (0)