From 8e1724184d42d05be48fe3c06df198722bfccae7 Mon Sep 17 00:00:00 2001 From: Ulf Hansson Date: Fri, 19 Sep 2014 20:27:38 +0200 Subject: drivercore / platform: Convert to dev_pm_domain_attach|detach() Previously only the ACPI PM domain was supported by the platform bus. Let's convert to the common attach/detach functions for PM domains, which currently means we are extending the support to include the generic PM domain as well. Signed-off-by: Ulf Hansson Tested-by: Philipp Zabel Reviewed-by: Kevin Hilman Reviewed-by: Dmitry Torokhov Signed-off-by: Rafael J. Wysocki (cherry picked from commit cb51841397e8e5714cf82a7f91053f6e1fb80d1f) (cherry picked from commit cd4edd4cb84f9dadb9e8f12b1e1f10bf2ef28749) --- drivers/base/platform.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/drivers/base/platform.c b/drivers/base/platform.c index 842b43813563..a8b09596a469 100644 --- a/drivers/base/platform.c +++ b/drivers/base/platform.c @@ -496,12 +496,12 @@ static int platform_drv_probe(struct device *_dev) if (ret < 0) return ret; - if (ACPI_HANDLE(_dev)) - acpi_dev_pm_attach(_dev, true); - - ret = drv->probe(dev); - if (ret && ACPI_HANDLE(_dev)) - acpi_dev_pm_detach(_dev, true); + ret = dev_pm_domain_attach(_dev, true); + if (ret != -EPROBE_DEFER) { + ret = drv->probe(dev); + if (ret) + dev_pm_domain_detach(_dev, true); + } if (drv->prevent_deferred_probe && ret == -EPROBE_DEFER) { dev_warn(_dev, "probe deferral not supported\n"); @@ -523,8 +523,7 @@ static int platform_drv_remove(struct device *_dev) int ret; ret = drv->remove(dev); - if (ACPI_HANDLE(_dev)) - acpi_dev_pm_detach(_dev, true); + dev_pm_domain_detach(_dev, true); return ret; } @@ -535,8 +534,7 @@ static void platform_drv_shutdown(struct device *_dev) struct platform_device *dev = to_platform_device(_dev); drv->shutdown(dev); - if (ACPI_HANDLE(_dev)) - acpi_dev_pm_detach(_dev, true); + dev_pm_domain_detach(_dev, true); } /** -- cgit v1.2.3