summaryrefslogtreecommitdiff
path: root/drivers/acpi/acpi_platform.c
diff options
context:
space:
mode:
authorAleksey Makarov <aleksey.makarov@linaro.org>2016-02-16 15:52:38 +0300
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2016-02-16 21:56:28 +0300
commit3b95bd160547f56a68aeb972c33ae9511e7a8380 (patch)
tree2aee4b0afd45b60ccde072b85be3e2298f034f35 /drivers/acpi/acpi_platform.c
parent18558cae0272f8fd9647e69d3fec1565a7949865 (diff)
downloadlinux-3b95bd160547f56a68aeb972c33ae9511e7a8380.tar.xz
ACPI: introduce a function to find the first physical device
Factor out the code that finds the first physical device of a given ACPI device. It is used in several places. Signed-off-by: Aleksey Makarov <aleksey.makarov@linaro.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/acpi/acpi_platform.c')
-rw-r--r--drivers/acpi/acpi_platform.c19
1 files changed, 2 insertions, 17 deletions
diff --git a/drivers/acpi/acpi_platform.c b/drivers/acpi/acpi_platform.c
index 296b7a14893a..c3af1088bf6b 100644
--- a/drivers/acpi/acpi_platform.c
+++ b/drivers/acpi/acpi_platform.c
@@ -43,7 +43,6 @@ static const struct acpi_device_id forbidden_id_list[] = {
struct platform_device *acpi_create_platform_device(struct acpi_device *adev)
{
struct platform_device *pdev = NULL;
- struct acpi_device *acpi_parent;
struct platform_device_info pdevinfo;
struct resource_entry *rentry;
struct list_head resource_list;
@@ -82,22 +81,8 @@ struct platform_device *acpi_create_platform_device(struct acpi_device *adev)
* attached to it, that physical device should be the parent of the
* platform device we are about to create.
*/
- pdevinfo.parent = NULL;
- 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);
- pdevinfo.parent = entry->dev;
- }
- mutex_unlock(&acpi_parent->physical_node_lock);
- }
+ pdevinfo.parent = adev->parent ?
+ acpi_get_first_physical_node(adev->parent) : NULL;
pdevinfo.name = dev_name(&adev->dev);
pdevinfo.id = -1;
pdevinfo.res = resources;