diff options
| -rw-r--r-- | drivers/acpi/acpi_platform.c | 38 | ||||
| -rw-r--r-- | drivers/acpi/scan.c | 4 |
2 files changed, 25 insertions, 17 deletions
diff --git a/drivers/acpi/acpi_platform.c b/drivers/acpi/acpi_platform.c index 48d15dd785f6..52c8d602f3a5 100644 --- a/drivers/acpi/acpi_platform.c +++ b/drivers/acpi/acpi_platform.c @@ -114,10 +114,8 @@ struct platform_device *acpi_create_platform_device(struct acpi_device *adev, struct platform_device *pdev = NULL; struct platform_device_info pdevinfo; const struct acpi_device_id *match; - struct resource_entry *rentry; - struct list_head resource_list; struct resource *resources = NULL; - int count; + int count = 0; /* If the ACPI node already has a physical device attached, skip it. */ if (adev->physical_node_count) @@ -137,22 +135,28 @@ struct platform_device *acpi_create_platform_device(struct acpi_device *adev, } } - INIT_LIST_HEAD(&resource_list); - count = acpi_dev_get_resources(adev, &resource_list, NULL, NULL); - if (count < 0) - return NULL; - if (count > 0) { - resources = kcalloc(count, sizeof(*resources), GFP_KERNEL); - if (!resources) { + if (adev->device_type == ACPI_BUS_TYPE_DEVICE) { + struct list_head resource_list = LIST_HEAD_INIT(resource_list); + + count = acpi_dev_get_resources(adev, &resource_list, NULL, NULL); + if (count < 0) + return ERR_PTR(-ENODATA); + + if (count > 0) { + struct resource_entry *rentry; + + resources = kcalloc(count, sizeof(*resources), GFP_KERNEL); + if (!resources) { + acpi_dev_free_resource_list(&resource_list); + return ERR_PTR(-ENOMEM); + } + count = 0; + list_for_each_entry(rentry, &resource_list, node) + acpi_platform_fill_resource(adev, rentry->res, + &resources[count++]); + acpi_dev_free_resource_list(&resource_list); - return ERR_PTR(-ENOMEM); } - count = 0; - list_for_each_entry(rentry, &resource_list, node) - acpi_platform_fill_resource(adev, rentry->res, - &resources[count++]); - - acpi_dev_free_resource_list(&resource_list); } memset(&pdevinfo, 0, sizeof(pdevinfo)); diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index 8a895d377e21..da4da565f257 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c @@ -2772,6 +2772,8 @@ static void acpi_bus_scan_fixed(void) device_init_wakeup(&adev->dev, true); else dev_dbg(&adev->dev, "No driver\n"); + + acpi_default_enumeration(adev); } } @@ -2784,6 +2786,8 @@ static void acpi_bus_scan_fixed(void) adev->flags.match_driver = true; if (device_attach(&adev->dev) < 0) dev_dbg(&adev->dev, "No driver\n"); + + acpi_default_enumeration(adev); } } } |
