linux-acpi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ACPI / LPSS: set first resuming device as a 'proxy'
@ 2015-01-15 11:10 Andy Shevchenko
  2015-01-20 14:45 ` Rafael J. Wysocki
  0 siblings, 1 reply; 5+ messages in thread
From: Andy Shevchenko @ 2015-01-15 11:10 UTC (permalink / raw)
  To: Rafael J. Wysocki, linux-acpi; +Cc: Andy Shevchenko

We can't rely on the first enumerated device since it might be not probed yet
when DMA driver wants to resume the device. This patch changes the place where
we assign the 'proxy' device. From now on the first resumed device will be
recognized as a 'proxy' because it is probed.

Reported-by: Jerome Blin <jerome.blin@intel.com>
Fixes: 6c17ee44d524 (ACPI / LPSS: introduce a 'proxy' device to power on LPSS for DMA)
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/acpi/acpi_lpss.c | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/drivers/acpi/acpi_lpss.c b/drivers/acpi/acpi_lpss.c
index 4f3febf..d851290 100644
--- a/drivers/acpi/acpi_lpss.c
+++ b/drivers/acpi/acpi_lpss.c
@@ -374,8 +374,6 @@ static int acpi_lpss_create_device(struct acpi_device *adev,
 	adev->driver_data = pdata;
 	pdev = acpi_create_platform_device(adev);
 	if (!IS_ERR_OR_NULL(pdev)) {
-		if (!proxy_device && dev_desc->flags & LPSS_DEV_PROXY)
-			proxy_device = &pdev->dev;
 		return 1;
 	}
 
@@ -615,10 +613,17 @@ static int acpi_lpss_runtime_resume(struct device *dev)
 	struct lpss_private_data *pdata = acpi_driver_data(ACPI_COMPANION(dev));
 	int ret;
 
-	if (pdata->dev_desc->flags & LPSS_PROXY_REQ && proxy_device) {
-		ret = pm_runtime_get_sync(proxy_device);
-		if (ret)
-			return ret;
+	if (!proxy_device && pdata->dev_desc->flags & LPSS_DEV_PROXY)
+		proxy_device = dev;
+
+	if (pdata->dev_desc->flags & LPSS_PROXY_REQ) {
+		if (proxy_device) {
+			ret = pm_runtime_get_sync(proxy_device);
+			if (ret)
+				return ret;
+		} else {
+			return -EPROBE_DEFER;
+		}
 	}
 
 	ret = acpi_dev_runtime_resume(dev);
-- 
2.1.4


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-01-22 15:17 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-15 11:10 [PATCH] ACPI / LPSS: set first resuming device as a 'proxy' Andy Shevchenko
2015-01-20 14:45 ` Rafael J. Wysocki
2015-01-21  2:37   ` Rafael J. Wysocki
2015-01-21 15:03     ` Rafael J. Wysocki
2015-01-22 15:16       ` Andy Shevchenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).