aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUlf Hansson <ulf.hansson@linaro.org>2019-04-25 05:04:10 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2019-04-25 17:18:03 -0400
commit51dcf7482f4b3166ef477d44181648110d501d25 (patch)
treec8b5a497272233836c58ba1953cab67b958feda4
parent40aa4db6d530e2ea71e00765df77ac78477e8348 (diff)
PM / Domains: Use the base device for driver_deferred_probe_check_state()
When genpd fails to attach a device to one of its multiple PM domains, we end up calling driver_deferred_probe_check_state() for the recently allocated virtual device. This is incorrect, as it's the base device that is being probed. Fix this by passing along the base device to __genpd_dev_pm_attach() and use that instead. Fixes: e01afc325025 ("PM / Domains: Stop deferring probe at the end of initcall") Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> Acked-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-rw-r--r--drivers/base/power/domain.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
index 8362dfe187f5..8aca1c9b4406 100644
--- a/drivers/base/power/domain.c
+++ b/drivers/base/power/domain.c
@@ -2405,8 +2405,8 @@ static void genpd_dev_pm_sync(struct device *dev)
2405 genpd_queue_power_off_work(pd); 2405 genpd_queue_power_off_work(pd);
2406} 2406}
2407 2407
2408static int __genpd_dev_pm_attach(struct device *dev, unsigned int index, 2408static int __genpd_dev_pm_attach(struct device *dev, struct device *base_dev,
2409 bool power_on) 2409 unsigned int index, bool power_on)
2410{ 2410{
2411 struct of_phandle_args pd_args; 2411 struct of_phandle_args pd_args;
2412 struct generic_pm_domain *pd; 2412 struct generic_pm_domain *pd;
@@ -2424,7 +2424,7 @@ static int __genpd_dev_pm_attach(struct device *dev, unsigned int index,
2424 mutex_unlock(&gpd_list_lock); 2424 mutex_unlock(&gpd_list_lock);
2425 dev_dbg(dev, "%s() failed to find PM domain: %ld\n", 2425 dev_dbg(dev, "%s() failed to find PM domain: %ld\n",
2426 __func__, PTR_ERR(pd)); 2426 __func__, PTR_ERR(pd));
2427 return driver_deferred_probe_check_state(dev); 2427 return driver_deferred_probe_check_state(base_dev);
2428 } 2428 }
2429 2429
2430 dev_dbg(dev, "adding to PM domain %s\n", pd->name); 2430 dev_dbg(dev, "adding to PM domain %s\n", pd->name);
@@ -2480,7 +2480,7 @@ int genpd_dev_pm_attach(struct device *dev)
2480 "#power-domain-cells") != 1) 2480 "#power-domain-cells") != 1)
2481 return 0; 2481 return 0;
2482 2482
2483 return __genpd_dev_pm_attach(dev, 0, true); 2483 return __genpd_dev_pm_attach(dev, dev, 0, true);
2484} 2484}
2485EXPORT_SYMBOL_GPL(genpd_dev_pm_attach); 2485EXPORT_SYMBOL_GPL(genpd_dev_pm_attach);
2486 2486
@@ -2533,7 +2533,7 @@ struct device *genpd_dev_pm_attach_by_id(struct device *dev,
2533 } 2533 }
2534 2534
2535 /* Try to attach the device to the PM domain at the specified index. */ 2535 /* Try to attach the device to the PM domain at the specified index. */
2536 ret = __genpd_dev_pm_attach(virt_dev, index, false); 2536 ret = __genpd_dev_pm_attach(virt_dev, dev, index, false);
2537 if (ret < 1) { 2537 if (ret < 1) {
2538 device_unregister(virt_dev); 2538 device_unregister(virt_dev);
2539 return ret ? ERR_PTR(ret) : NULL; 2539 return ret ? ERR_PTR(ret) : NULL;