Merge tag 'pci-v4.6-changes' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci
[cascardo/linux.git] / drivers / acpi / acpi_platform.c
index b6f7fa3..159f7f1 100644 (file)
@@ -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;