summaryrefslogtreecommitdiff
path: root/drivers/acpi/container.c
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2014-05-30 04:28:20 +0200
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2014-05-30 16:04:36 +0200
commita1ec657213b4abb00e59385171554a3e11eec27c (patch)
treef0401522eb90acee967c21660a4e3144b8276741 /drivers/acpi/container.c
parentd34afa9de4447367b734ec407e5a9e10617d6ec3 (diff)
downloadlwn-a1ec657213b4abb00e59385171554a3e11eec27c.tar.gz
lwn-a1ec657213b4abb00e59385171554a3e11eec27c.zip
ACPI / scan: always register container scan handler
Prevent platform devices from being created for ACPI containers if CONFIG_ACPI_CONTAINER is unset by compiling out the container scan handler's callbacks only in that case and still compiling its device ID list in and registering the scan handler in either case. This change is based on a prototype from Zhang Rui. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Diffstat (limited to 'drivers/acpi/container.c')
-rw-r--r--drivers/acpi/container.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/drivers/acpi/container.c b/drivers/acpi/container.c
index 63119d09b354..76f7cff64594 100644
--- a/drivers/acpi/container.c
+++ b/drivers/acpi/container.c
@@ -41,6 +41,8 @@ static const struct acpi_device_id container_device_ids[] = {
{"", 0},
};
+#ifdef CONFIG_ACPI_CONTAINER
+
static int acpi_container_offline(struct container_dev *cdev)
{
struct acpi_device *adev = ACPI_COMPANION(&cdev->dev);
@@ -109,5 +111,18 @@ static struct acpi_scan_handler container_handler = {
void __init acpi_container_init(void)
{
+ acpi_scan_add_handler(&container_handler);
+}
+
+#else
+
+static struct acpi_scan_handler container_handler = {
+ .ids = container_device_ids,
+};
+
+void __init acpi_container_init(void)
+{
acpi_scan_add_handler_with_hotplug(&container_handler, "container");
}
+
+#endif /* CONFIG_ACPI_CONTAINER */