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
This commit is contained in:
@@ -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;
|
||||
|
||||
return drv->remove(dev);
|
||||
ret = drv->remove(dev);
|
||||
if (ACPI_HANDLE(_dev))
|
||||
acpi_dev_pm_detach(_dev, true);
|
||||
|
||||
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;
|
||||
|
Reference in New Issue
Block a user