diff options
author | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2012-11-29 21:41:25 +0100 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2012-11-29 21:41:25 +0100 |
commit | bcacbdbdc8d2481f10f09fea8e470d3b36751043 (patch) | |
tree | 6519d94f28133f0e2ad0983bd79cf34e6ba08706 /drivers/base | |
parent | acd844333c89e8afd85e8ca47b4363789c93780d (diff) | |
parent | 752cad760b19e85926341880dc317a99f400eacc (diff) | |
download | lwn-bcacbdbdc8d2481f10f09fea8e470d3b36751043.tar.gz lwn-bcacbdbdc8d2481f10f09fea8e470d3b36751043.zip |
Merge branch 'acpi-enumeration'
* acpi-enumeration:
ACPI: remove unnecessary INIT_LIST_HEAD
ACPI / platform: include missed header into acpi_platform.c
platform / ACPI: Attach/detach ACPI PM during probe/remove/shutdown
mmc: sdhci-acpi: add SDHCI ACPI driver
ACPI: add SDHCI to ACPI platform devices
ACPI / PNP: skip ACPI device nodes associated with physical nodes already
i2c / ACPI: add ACPI enumeration support
ACPI / platform: Initialize ACPI handles of platform devices in advance
ACPI / driver core: Introduce struct acpi_dev_node and related macros
ACPI: Allow ACPI handles of devices to be initialized in advance
ACPI / resources: Use AE_CTRL_TERMINATE to terminate resources walks
ACPI: Centralized processing of ACPI device resources
ACPI / platform: Use common ACPI device resource parsing routines
ACPI: Move device resources interpretation code from PNP to ACPI core
ACPI / platform: use ACPI device name instead of _HID._UID
ACPI: Add support for platform bus type
ACPI / ia64: Export acpi_[un]register_gsi()
ACPI / x86: Export acpi_[un]register_gsi()
ACPI: Provide generic functions for matching ACPI device nodes
driver core / ACPI: Move ACPI support to core device and driver types
Diffstat (limited to 'drivers/base')
-rw-r--r-- | drivers/base/platform.c | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/drivers/base/platform.c b/drivers/base/platform.c index 72c776f2a1f5..b2ee3bcd5a41 100644 --- a/drivers/base/platform.c +++ b/drivers/base/platform.c @@ -21,6 +21,7 @@ #include <linux/slab.h> #include <linux/pm_runtime.h> #include <linux/idr.h> +#include <linux/acpi.h> #include "base.h" #include "power/power.h" @@ -436,6 +437,7 @@ struct platform_device *platform_device_register_full( goto err_alloc; pdev->dev.parent = pdevinfo->parent; + ACPI_HANDLE_SET(&pdev->dev, pdevinfo->acpi_node.handle); if (pdevinfo->dma_mask) { /* @@ -466,6 +468,7 @@ struct platform_device *platform_device_register_full( ret = platform_device_add(pdev); if (ret) { err: + ACPI_HANDLE_SET(&pdev->dev, NULL); kfree(pdev->dev.dma_mask); err_alloc: @@ -481,8 +484,16 @@ static int platform_drv_probe(struct device *_dev) { struct platform_driver *drv = to_platform_driver(_dev->driver); struct platform_device *dev = to_platform_device(_dev); + int ret; - return drv->probe(dev); + 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); + + return ret; } static int platform_drv_probe_fail(struct device *_dev) @@ -494,8 +505,13 @@ static int platform_drv_remove(struct device *_dev) { struct platform_driver *drv = to_platform_driver(_dev->driver); struct platform_device *dev = to_platform_device(_dev); + int ret; + + ret = drv->remove(dev); + if (ACPI_HANDLE(_dev)) + acpi_dev_pm_detach(_dev, true); - return drv->remove(dev); + return ret; } static void platform_drv_shutdown(struct device *_dev) @@ -504,6 +520,8 @@ 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); } /** @@ -709,6 +727,10 @@ static int platform_match(struct device *dev, struct device_driver *drv) if (of_driver_match_device(dev, drv)) return 1; + /* Then try ACPI style match */ + if (acpi_driver_match_device(dev, drv)) + return 1; + /* Then try to match against the id table */ if (pdrv->id_table) return platform_match_id(pdrv->id_table, pdev) != NULL; |