opp: of: Allow empty opp-table with opp-shared
authorNicola Mazzucato <nicola.mazzucato@arm.com>
Tue, 8 Dec 2020 17:42:27 +0000 (17:42 +0000)
committerViresh Kumar <viresh.kumar@linaro.org>
Wed, 9 Dec 2020 05:53:46 +0000 (11:23 +0530)
The opp binding now allows to have an empty opp table and shared-opp to
still describe that devices share v/f lines.

When initialising an empty opp table, allow such case by:
- treating such conditions with warnings in place of errors
- don't fail on empty table

Signed-off-by: Nicola Mazzucato <nicola.mazzucato@arm.com>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
drivers/opp/of.c

index 874b587..96113fc 100644 (file)
@@ -169,7 +169,8 @@ static void _opp_table_alloc_required_tables(struct opp_table *opp_table,
        /* Traversing the first OPP node is all we need */
        np = of_get_next_available_child(opp_np, NULL);
        if (!np) {
-               dev_err(dev, "Empty OPP table\n");
+               dev_warn(dev, "Empty OPP table\n");
+
                return;
        }
 
@@ -377,7 +378,9 @@ int dev_pm_opp_of_find_icc_paths(struct device *dev,
        struct icc_path **paths;
 
        ret = _bandwidth_supported(dev, opp_table);
-       if (ret <= 0)
+       if (ret == -EINVAL)
+               return 0; /* Empty OPP table is a valid corner-case, let's not fail */
+       else if (ret <= 0)
                return ret;
 
        ret = 0;