have_genpd_providers is a pre-deep-probe artifact, where SoC support
would promise that a power domain driver will be registered.

In a deep probe system, we can just force the probe in
__genpd_dev_pm_attach.

Therefore, move the check for have_genpd_providers, until after the
lookup of power domain drivers.

This will be further refined in follow-up commits.

Signed-off-by: Ahmad Fatoum <[email protected]>
---
v1 -> v2:
  - add missing commit messages
---
 drivers/base/power.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/base/power.c b/drivers/base/power.c
index d60a00f5735e..0cdece210d94 100644
--- a/drivers/base/power.c
+++ b/drivers/base/power.c
@@ -371,9 +371,6 @@ static int __genpd_dev_pm_attach(struct device *dev,
        struct generic_pm_domain *pd;
        int ret;
 
-       if (!have_genpd_providers)
-               return 0;
-
        ret = of_parse_phandle_with_args(dev->of_node, "power-domains",
                                "#power-domain-cells", index, &pd_args);
        if (ret < 0)
@@ -384,11 +381,18 @@ static int __genpd_dev_pm_attach(struct device *dev,
                ret = PTR_ERR(pd);
                dev_dbg(dev, "%s() failed to find PM domain: %d\n",
                        __func__, ret);
+
+               if (ret == -ENOENT)
+                       ret = -EPROBE_DEFER;
+
+               if (!have_genpd_providers && ret == -EPROBE_DEFER)
+                       return 0;
+
                /*
                 * Assume that missing genpds are unresolved
                 * dependency are report them as deferred
                 */
-               return (ret == -ENOENT) ? -EPROBE_DEFER : ret;
+               return ret;
        }
 
        dev_dbg(dev, "adding to PM domain %s\n", pd ? pd->name : "dummy");
-- 
2.47.3


Reply via email to