2012-11-01 05:45:02 +08:00
|
|
|
/*
|
|
|
|
* ACPI support for platform bus type.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2012, Intel Corporation
|
|
|
|
* Authors: Mika Westerberg <mika.westerberg@linux.intel.com>
|
|
|
|
* Mathias Nyman <mathias.nyman@linux.intel.com>
|
|
|
|
* Rafael J. Wysocki <rafael.j.wysocki@intel.com>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License version 2 as
|
|
|
|
* published by the Free Software Foundation.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/acpi.h>
|
|
|
|
#include <linux/device.h>
|
2013-01-18 21:46:01 +08:00
|
|
|
#include <linux/err.h>
|
2012-11-01 05:45:02 +08:00
|
|
|
#include <linux/kernel.h>
|
|
|
|
#include <linux/module.h>
|
|
|
|
#include <linux/platform_device.h>
|
|
|
|
|
2012-11-26 17:35:07 +08:00
|
|
|
#include "internal.h"
|
|
|
|
|
2012-11-01 05:45:02 +08:00
|
|
|
ACPI_MODULE_NAME("platform");
|
|
|
|
|
2013-01-30 21:27:40 +08:00
|
|
|
/*
|
|
|
|
* The following ACPI IDs are known to be suitable for representing as
|
|
|
|
* platform devices.
|
|
|
|
*/
|
|
|
|
static const struct acpi_device_id acpi_platform_device_ids[] = {
|
|
|
|
|
|
|
|
{ "PNP0D40" },
|
2013-09-25 20:39:45 +08:00
|
|
|
{ "ACPI0003" },
|
2013-09-25 20:39:50 +08:00
|
|
|
{ "VPC2004" },
|
2013-10-16 18:15:14 +08:00
|
|
|
{ "BCM4752" },
|
2013-01-30 21:27:40 +08:00
|
|
|
|
2013-10-07 22:12:21 +08:00
|
|
|
/* Intel Smart Sound Technology */
|
|
|
|
{ "INT33C8" },
|
|
|
|
{ "80860F28" },
|
2013-10-16 23:04:41 +08:00
|
|
|
|
2013-01-30 21:27:40 +08:00
|
|
|
{ }
|
|
|
|
};
|
|
|
|
|
2012-11-01 05:45:02 +08:00
|
|
|
/**
|
|
|
|
* acpi_create_platform_device - Create platform device for ACPI device node
|
|
|
|
* @adev: ACPI device node to create a platform device for.
|
2013-01-30 21:27:40 +08:00
|
|
|
* @id: ACPI device ID used to match @adev.
|
2012-11-01 05:45:02 +08:00
|
|
|
*
|
|
|
|
* Check if the given @adev can be represented as a platform device and, if
|
|
|
|
* that's the case, create and register a platform device, populate its common
|
|
|
|
* resources and returns a pointer to it. Otherwise, return %NULL.
|
|
|
|
*
|
2013-01-18 22:09:35 +08:00
|
|
|
* Name of the platform device will be the same as @adev's.
|
2012-11-01 05:45:02 +08:00
|
|
|
*/
|
2013-03-07 06:46:20 +08:00
|
|
|
int acpi_create_platform_device(struct acpi_device *adev,
|
|
|
|
const struct acpi_device_id *id)
|
2012-11-01 05:45:02 +08:00
|
|
|
{
|
|
|
|
struct platform_device *pdev = NULL;
|
|
|
|
struct acpi_device *acpi_parent;
|
ACPI / platform: Initialize ACPI handles of platform devices in advance
The current platform device creation and registration code in
acpi_create_platform_device() is quite convoluted. This function
takes an ACPI device node as an argument and eventually calls
platform_device_register_resndata() to create and register a
platform device object on the basis of the information contained
in that code. However, it doesn't associate the new platform
device with the ACPI node directly, but instead it relies on
acpi_platform_notify(), called from within device_add(), to find
that ACPI node again with the help of acpi_platform_find_device()
and acpi_platform_match() and then attach the new platform device
to it. This causes an additional ACPI namespace walk to happen and
is clearly suboptimal.
Use the observation that it is now possible to initialize the ACPI
handle of a device before calling device_add() for it to make this
code more straightforward. Namely, add a new field to struct
platform_device_info allowing us to pass the ACPI handle of interest
to platform_device_register_full(), which will then use it to
initialize the new device's ACPI handle before registering it.
This will cause acpi_platform_notify() to use the ACPI handle from
the device structure directly instead of using the .find_device()
routine provided by the device's bus type. In consequence,
acpi_platform_bus, acpi_platform_find_device(), and
acpi_platform_match() are not necessary any more, so remove them.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-21 07:21:59 +08:00
|
|
|
struct platform_device_info pdevinfo;
|
ACPI: Centralized processing of ACPI device resources
Currently, whoever wants to use ACPI device resources has to call
acpi_walk_resources() to browse the buffer returned by the _CRS
method for the given device and create filters passed to that
routine to apply to the individual resource items. This generally
is cumbersome, time-consuming and inefficient. Moreover, it may
be problematic if resource conflicts need to be resolved, because
the different users of _CRS will need to do that in a consistent
way. However, if there are resource conflicts, the ACPI core
should be able to resolve them centrally instead of relying on
various users of acpi_walk_resources() to handle them correctly
together.
For this reason, introduce a new function, acpi_dev_get_resources(),
that can be used by subsystems to obtain a list of struct resource
objects corresponding to the ACPI device resources returned by
_CRS and, if necessary, to apply additional preprocessing routine
to the ACPI resources before converting them to the struct resource
format.
Make the ACPI code that creates platform device objects use
acpi_dev_get_resources() for resource processing instead of executing
acpi_walk_resources() twice by itself, which causes it to be much
more straightforward and easier to follow.
In the future, acpi_dev_get_resources() can be extended to meet
the needs of the ACPI PNP subsystem and other users of _CRS in
the kernel.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Tested-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2012-11-15 07:30:21 +08:00
|
|
|
struct resource_list_entry *rentry;
|
|
|
|
struct list_head resource_list;
|
2013-07-23 07:51:20 +08:00
|
|
|
struct resource *resources = NULL;
|
ACPI: Centralized processing of ACPI device resources
Currently, whoever wants to use ACPI device resources has to call
acpi_walk_resources() to browse the buffer returned by the _CRS
method for the given device and create filters passed to that
routine to apply to the individual resource items. This generally
is cumbersome, time-consuming and inefficient. Moreover, it may
be problematic if resource conflicts need to be resolved, because
the different users of _CRS will need to do that in a consistent
way. However, if there are resource conflicts, the ACPI core
should be able to resolve them centrally instead of relying on
various users of acpi_walk_resources() to handle them correctly
together.
For this reason, introduce a new function, acpi_dev_get_resources(),
that can be used by subsystems to obtain a list of struct resource
objects corresponding to the ACPI device resources returned by
_CRS and, if necessary, to apply additional preprocessing routine
to the ACPI resources before converting them to the struct resource
format.
Make the ACPI code that creates platform device objects use
acpi_dev_get_resources() for resource processing instead of executing
acpi_walk_resources() twice by itself, which causes it to be much
more straightforward and easier to follow.
In the future, acpi_dev_get_resources() can be extended to meet
the needs of the ACPI PNP subsystem and other users of _CRS in
the kernel.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Tested-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2012-11-15 07:30:21 +08:00
|
|
|
int count;
|
2012-11-01 05:45:02 +08:00
|
|
|
|
|
|
|
/* If the ACPI node already has a physical device attached, skip it. */
|
|
|
|
if (adev->physical_node_count)
|
2013-01-30 21:27:40 +08:00
|
|
|
return 0;
|
2012-11-01 05:45:02 +08:00
|
|
|
|
ACPI: Centralized processing of ACPI device resources
Currently, whoever wants to use ACPI device resources has to call
acpi_walk_resources() to browse the buffer returned by the _CRS
method for the given device and create filters passed to that
routine to apply to the individual resource items. This generally
is cumbersome, time-consuming and inefficient. Moreover, it may
be problematic if resource conflicts need to be resolved, because
the different users of _CRS will need to do that in a consistent
way. However, if there are resource conflicts, the ACPI core
should be able to resolve them centrally instead of relying on
various users of acpi_walk_resources() to handle them correctly
together.
For this reason, introduce a new function, acpi_dev_get_resources(),
that can be used by subsystems to obtain a list of struct resource
objects corresponding to the ACPI device resources returned by
_CRS and, if necessary, to apply additional preprocessing routine
to the ACPI resources before converting them to the struct resource
format.
Make the ACPI code that creates platform device objects use
acpi_dev_get_resources() for resource processing instead of executing
acpi_walk_resources() twice by itself, which causes it to be much
more straightforward and easier to follow.
In the future, acpi_dev_get_resources() can be extended to meet
the needs of the ACPI PNP subsystem and other users of _CRS in
the kernel.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Tested-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2012-11-15 07:30:21 +08:00
|
|
|
INIT_LIST_HEAD(&resource_list);
|
|
|
|
count = acpi_dev_get_resources(adev, &resource_list, NULL, NULL);
|
2013-08-07 07:11:33 +08:00
|
|
|
if (count < 0) {
|
2013-01-30 21:27:40 +08:00
|
|
|
return 0;
|
2013-08-07 07:11:33 +08:00
|
|
|
} else if (count > 0) {
|
|
|
|
resources = kmalloc(count * sizeof(struct resource),
|
|
|
|
GFP_KERNEL);
|
|
|
|
if (!resources) {
|
|
|
|
dev_err(&adev->dev, "No memory for resources\n");
|
|
|
|
acpi_dev_free_resource_list(&resource_list);
|
|
|
|
return -ENOMEM;
|
|
|
|
}
|
|
|
|
count = 0;
|
|
|
|
list_for_each_entry(rentry, &resource_list, node)
|
|
|
|
resources[count++] = rentry->res;
|
2012-11-01 05:45:02 +08:00
|
|
|
|
ACPI: Centralized processing of ACPI device resources
Currently, whoever wants to use ACPI device resources has to call
acpi_walk_resources() to browse the buffer returned by the _CRS
method for the given device and create filters passed to that
routine to apply to the individual resource items. This generally
is cumbersome, time-consuming and inefficient. Moreover, it may
be problematic if resource conflicts need to be resolved, because
the different users of _CRS will need to do that in a consistent
way. However, if there are resource conflicts, the ACPI core
should be able to resolve them centrally instead of relying on
various users of acpi_walk_resources() to handle them correctly
together.
For this reason, introduce a new function, acpi_dev_get_resources(),
that can be used by subsystems to obtain a list of struct resource
objects corresponding to the ACPI device resources returned by
_CRS and, if necessary, to apply additional preprocessing routine
to the ACPI resources before converting them to the struct resource
format.
Make the ACPI code that creates platform device objects use
acpi_dev_get_resources() for resource processing instead of executing
acpi_walk_resources() twice by itself, which causes it to be much
more straightforward and easier to follow.
In the future, acpi_dev_get_resources() can be extended to meet
the needs of the ACPI PNP subsystem and other users of _CRS in
the kernel.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Tested-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2012-11-15 07:30:21 +08:00
|
|
|
acpi_dev_free_resource_list(&resource_list);
|
2012-11-01 05:45:02 +08:00
|
|
|
}
|
|
|
|
|
ACPI / platform: Initialize ACPI handles of platform devices in advance
The current platform device creation and registration code in
acpi_create_platform_device() is quite convoluted. This function
takes an ACPI device node as an argument and eventually calls
platform_device_register_resndata() to create and register a
platform device object on the basis of the information contained
in that code. However, it doesn't associate the new platform
device with the ACPI node directly, but instead it relies on
acpi_platform_notify(), called from within device_add(), to find
that ACPI node again with the help of acpi_platform_find_device()
and acpi_platform_match() and then attach the new platform device
to it. This causes an additional ACPI namespace walk to happen and
is clearly suboptimal.
Use the observation that it is now possible to initialize the ACPI
handle of a device before calling device_add() for it to make this
code more straightforward. Namely, add a new field to struct
platform_device_info allowing us to pass the ACPI handle of interest
to platform_device_register_full(), which will then use it to
initialize the new device's ACPI handle before registering it.
This will cause acpi_platform_notify() to use the ACPI handle from
the device structure directly instead of using the .find_device()
routine provided by the device's bus type. In consequence,
acpi_platform_bus, acpi_platform_find_device(), and
acpi_platform_match() are not necessary any more, so remove them.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-21 07:21:59 +08:00
|
|
|
memset(&pdevinfo, 0, sizeof(pdevinfo));
|
2012-11-01 05:45:02 +08:00
|
|
|
/*
|
|
|
|
* If the ACPI node has a parent and that parent has a physical device
|
|
|
|
* attached to it, that physical device should be the parent of the
|
|
|
|
* platform device we are about to create.
|
|
|
|
*/
|
ACPI / platform: Initialize ACPI handles of platform devices in advance
The current platform device creation and registration code in
acpi_create_platform_device() is quite convoluted. This function
takes an ACPI device node as an argument and eventually calls
platform_device_register_resndata() to create and register a
platform device object on the basis of the information contained
in that code. However, it doesn't associate the new platform
device with the ACPI node directly, but instead it relies on
acpi_platform_notify(), called from within device_add(), to find
that ACPI node again with the help of acpi_platform_find_device()
and acpi_platform_match() and then attach the new platform device
to it. This causes an additional ACPI namespace walk to happen and
is clearly suboptimal.
Use the observation that it is now possible to initialize the ACPI
handle of a device before calling device_add() for it to make this
code more straightforward. Namely, add a new field to struct
platform_device_info allowing us to pass the ACPI handle of interest
to platform_device_register_full(), which will then use it to
initialize the new device's ACPI handle before registering it.
This will cause acpi_platform_notify() to use the ACPI handle from
the device structure directly instead of using the .find_device()
routine provided by the device's bus type. In consequence,
acpi_platform_bus, acpi_platform_find_device(), and
acpi_platform_match() are not necessary any more, so remove them.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-21 07:21:59 +08:00
|
|
|
pdevinfo.parent = NULL;
|
2012-11-01 05:45:02 +08:00
|
|
|
acpi_parent = adev->parent;
|
|
|
|
if (acpi_parent) {
|
|
|
|
struct acpi_device_physical_node *entry;
|
|
|
|
struct list_head *list;
|
|
|
|
|
|
|
|
mutex_lock(&acpi_parent->physical_node_lock);
|
|
|
|
list = &acpi_parent->physical_node_list;
|
|
|
|
if (!list_empty(list)) {
|
|
|
|
entry = list_first_entry(list,
|
|
|
|
struct acpi_device_physical_node,
|
|
|
|
node);
|
ACPI / platform: Initialize ACPI handles of platform devices in advance
The current platform device creation and registration code in
acpi_create_platform_device() is quite convoluted. This function
takes an ACPI device node as an argument and eventually calls
platform_device_register_resndata() to create and register a
platform device object on the basis of the information contained
in that code. However, it doesn't associate the new platform
device with the ACPI node directly, but instead it relies on
acpi_platform_notify(), called from within device_add(), to find
that ACPI node again with the help of acpi_platform_find_device()
and acpi_platform_match() and then attach the new platform device
to it. This causes an additional ACPI namespace walk to happen and
is clearly suboptimal.
Use the observation that it is now possible to initialize the ACPI
handle of a device before calling device_add() for it to make this
code more straightforward. Namely, add a new field to struct
platform_device_info allowing us to pass the ACPI handle of interest
to platform_device_register_full(), which will then use it to
initialize the new device's ACPI handle before registering it.
This will cause acpi_platform_notify() to use the ACPI handle from
the device structure directly instead of using the .find_device()
routine provided by the device's bus type. In consequence,
acpi_platform_bus, acpi_platform_find_device(), and
acpi_platform_match() are not necessary any more, so remove them.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-21 07:21:59 +08:00
|
|
|
pdevinfo.parent = entry->dev;
|
2012-11-01 05:45:02 +08:00
|
|
|
}
|
|
|
|
mutex_unlock(&acpi_parent->physical_node_lock);
|
|
|
|
}
|
ACPI / platform: Initialize ACPI handles of platform devices in advance
The current platform device creation and registration code in
acpi_create_platform_device() is quite convoluted. This function
takes an ACPI device node as an argument and eventually calls
platform_device_register_resndata() to create and register a
platform device object on the basis of the information contained
in that code. However, it doesn't associate the new platform
device with the ACPI node directly, but instead it relies on
acpi_platform_notify(), called from within device_add(), to find
that ACPI node again with the help of acpi_platform_find_device()
and acpi_platform_match() and then attach the new platform device
to it. This causes an additional ACPI namespace walk to happen and
is clearly suboptimal.
Use the observation that it is now possible to initialize the ACPI
handle of a device before calling device_add() for it to make this
code more straightforward. Namely, add a new field to struct
platform_device_info allowing us to pass the ACPI handle of interest
to platform_device_register_full(), which will then use it to
initialize the new device's ACPI handle before registering it.
This will cause acpi_platform_notify() to use the ACPI handle from
the device structure directly instead of using the .find_device()
routine provided by the device's bus type. In consequence,
acpi_platform_bus, acpi_platform_find_device(), and
acpi_platform_match() are not necessary any more, so remove them.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-21 07:21:59 +08:00
|
|
|
pdevinfo.name = dev_name(&adev->dev);
|
|
|
|
pdevinfo.id = -1;
|
|
|
|
pdevinfo.res = resources;
|
|
|
|
pdevinfo.num_res = count;
|
ACPI / driver core: Store an ACPI device pointer in struct acpi_dev_node
Modify struct acpi_dev_node to contain a pointer to struct acpi_device
associated with the given device object (that is, its ACPI companion
device) instead of an ACPI handle corresponding to it. Introduce two
new macros for manipulating that pointer in a CONFIG_ACPI-safe way,
ACPI_COMPANION() and ACPI_COMPANION_SET(), and rework the
ACPI_HANDLE() macro to take the above changes into account.
Drop the ACPI_HANDLE_SET() macro entirely and rework its users to
use ACPI_COMPANION_SET() instead. For some of them who used to
pass the result of acpi_get_child() directly to ACPI_HANDLE_SET()
introduce a helper routine acpi_preset_companion() doing an
equivalent thing.
The main motivation for doing this is that there are things
represented by struct acpi_device objects that don't have valid
ACPI handles (so called fixed ACPI hardware features, such as
power and sleep buttons) and we would like to create platform
device objects for them and "glue" them to their ACPI companions
in the usual way (which currently is impossible due to the
lack of valid ACPI handles). However, there are more reasons
why it may be useful.
First, struct acpi_device pointers allow of much better type checking
than void pointers which are ACPI handles, so it should be more
difficult to write buggy code using modified struct acpi_dev_node
and the new macros. Second, the change should help to reduce (over
time) the number of places in which the result of ACPI_HANDLE() is
passed to acpi_bus_get_device() in order to obtain a pointer to the
struct acpi_device associated with the given "physical" device,
because now that pointer is returned by ACPI_COMPANION() directly.
Finally, the change should make it easier to write generic code that
will build both for CONFIG_ACPI set and unset without adding explicit
compiler directives to it.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Tested-by: Mika Westerberg <mika.westerberg@linux.intel.com> # on Haswell
Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Reviewed-by: Aaron Lu <aaron.lu@intel.com> # for ATA and SDIO part
2013-11-12 05:41:56 +08:00
|
|
|
pdevinfo.acpi_node.companion = adev;
|
ACPI / platform: Initialize ACPI handles of platform devices in advance
The current platform device creation and registration code in
acpi_create_platform_device() is quite convoluted. This function
takes an ACPI device node as an argument and eventually calls
platform_device_register_resndata() to create and register a
platform device object on the basis of the information contained
in that code. However, it doesn't associate the new platform
device with the ACPI node directly, but instead it relies on
acpi_platform_notify(), called from within device_add(), to find
that ACPI node again with the help of acpi_platform_find_device()
and acpi_platform_match() and then attach the new platform device
to it. This causes an additional ACPI namespace walk to happen and
is clearly suboptimal.
Use the observation that it is now possible to initialize the ACPI
handle of a device before calling device_add() for it to make this
code more straightforward. Namely, add a new field to struct
platform_device_info allowing us to pass the ACPI handle of interest
to platform_device_register_full(), which will then use it to
initialize the new device's ACPI handle before registering it.
This will cause acpi_platform_notify() to use the ACPI handle from
the device structure directly instead of using the .find_device()
routine provided by the device's bus type. In consequence,
acpi_platform_bus, acpi_platform_find_device(), and
acpi_platform_match() are not necessary any more, so remove them.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-21 07:21:59 +08:00
|
|
|
pdev = platform_device_register_full(&pdevinfo);
|
2012-11-01 05:45:02 +08:00
|
|
|
if (IS_ERR(pdev)) {
|
|
|
|
dev_err(&adev->dev, "platform device creation failed: %ld\n",
|
|
|
|
PTR_ERR(pdev));
|
|
|
|
pdev = NULL;
|
|
|
|
} else {
|
|
|
|
dev_dbg(&adev->dev, "created platform device %s\n",
|
|
|
|
dev_name(&pdev->dev));
|
|
|
|
}
|
|
|
|
|
ACPI: Centralized processing of ACPI device resources
Currently, whoever wants to use ACPI device resources has to call
acpi_walk_resources() to browse the buffer returned by the _CRS
method for the given device and create filters passed to that
routine to apply to the individual resource items. This generally
is cumbersome, time-consuming and inefficient. Moreover, it may
be problematic if resource conflicts need to be resolved, because
the different users of _CRS will need to do that in a consistent
way. However, if there are resource conflicts, the ACPI core
should be able to resolve them centrally instead of relying on
various users of acpi_walk_resources() to handle them correctly
together.
For this reason, introduce a new function, acpi_dev_get_resources(),
that can be used by subsystems to obtain a list of struct resource
objects corresponding to the ACPI device resources returned by
_CRS and, if necessary, to apply additional preprocessing routine
to the ACPI resources before converting them to the struct resource
format.
Make the ACPI code that creates platform device objects use
acpi_dev_get_resources() for resource processing instead of executing
acpi_walk_resources() twice by itself, which causes it to be much
more straightforward and easier to follow.
In the future, acpi_dev_get_resources() can be extended to meet
the needs of the ACPI PNP subsystem and other users of _CRS in
the kernel.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Tested-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2012-11-15 07:30:21 +08:00
|
|
|
kfree(resources);
|
2013-01-30 21:27:40 +08:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static struct acpi_scan_handler platform_handler = {
|
|
|
|
.ids = acpi_platform_device_ids,
|
|
|
|
.attach = acpi_create_platform_device,
|
|
|
|
};
|
|
|
|
|
|
|
|
void __init acpi_platform_init(void)
|
|
|
|
{
|
|
|
|
acpi_scan_add_handler(&platform_handler);
|
2012-11-01 05:45:02 +08:00
|
|
|
}
|