[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1432570172-86963-4-git-send-email-andriy.shevchenko@linux.intel.com>
Date: Mon, 25 May 2015 19:09:27 +0300
From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To: "Rafael J. Wysocki" <rjw@...ysocki.net>,
linux-acpi@...r.kernel.org, linux-pm@...r.kernel.org,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Vinod Koul <vinod.koul@...el.com>,
Lee Jones <lee.jones@...aro.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Mika Westerberg <mika.westerberg@...ux.intel.com>,
linux-kernel@...r.kernel.org, dmaengine@...r.kernel.org,
Heikki Krogerus <heikki.krogerus@...ux.intel.com>,
Jarkko Nikula <jarkko.nikula@...ux.intel.com>
Cc: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Subject: [PATCH v2 3/8] core: platform: wakeup the parent before trying any driver operations
From: Heikki Krogerus <heikki.krogerus@...ux.intel.com>
If the parent is still suspended when a driver probe,
remove or shutdown is attempted, the result may be a
failure.
For example, if the parent is a PCI MFD device that has been
suspended when we try to probe our device, any register
reads will return 0xffffffff.
To fix the problem, making sure the parent is always awake
before using driver probe, remove or shutdown.
Signed-off-by: Heikki Krogerus <heikki.krogerus@...ux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
---
drivers/base/platform.c | 21 ++++++++++++++++++++-
1 file changed, 20 insertions(+), 1 deletion(-)
diff --git a/drivers/base/platform.c b/drivers/base/platform.c
index ebf034b..59fcda5 100644
--- a/drivers/base/platform.c
+++ b/drivers/base/platform.c
@@ -518,9 +518,15 @@ static int platform_drv_probe(struct device *_dev)
ret = dev_pm_domain_attach(_dev, true);
if (ret != -EPROBE_DEFER) {
+ if (_dev->parent != &platform_bus)
+ pm_runtime_get_sync(_dev->parent);
+
ret = drv->probe(dev);
if (ret)
dev_pm_domain_detach(_dev, true);
+
+ if (_dev->parent != &platform_bus)
+ pm_runtime_put(_dev->parent);
}
if (drv->prevent_deferred_probe && ret == -EPROBE_DEFER) {
@@ -542,9 +548,15 @@ static int platform_drv_remove(struct device *_dev)
struct platform_device *dev = to_platform_device(_dev);
int ret;
+ if (_dev->parent != &platform_bus)
+ pm_runtime_get_sync(_dev->parent);
+
ret = drv->remove(dev);
- dev_pm_domain_detach(_dev, true);
+ if (_dev->parent != &platform_bus)
+ pm_runtime_put(_dev->parent);
+
+ dev_pm_domain_detach(_dev, true);
return ret;
}
@@ -553,7 +565,14 @@ static void platform_drv_shutdown(struct device *_dev)
struct platform_driver *drv = to_platform_driver(_dev->driver);
struct platform_device *dev = to_platform_device(_dev);
+ if (_dev->parent != &platform_bus)
+ pm_runtime_get_sync(_dev->parent);
+
drv->shutdown(dev);
+
+ if (_dev->parent != &platform_bus)
+ pm_runtime_put(_dev->parent);
+
dev_pm_domain_detach(_dev, true);
}
--
2.1.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists