aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi
diff options
context:
space:
mode:
authorKuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>2013-07-22 19:51:20 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2013-08-06 08:12:21 -0400
commit62eb4b07f0803d0426eb695bfe6755dd6a2cafb2 (patch)
treefa0a80fdfa1b60d09df854011b1096eb0306d3c8 /drivers/acpi
parent1129c92faa069581bf3acf34cae92477bd6161d8 (diff)
ACPI / scan: Allow platform device creation without any IO resources
Currently, ACPI platform device creation is aborted when there are no valid IO resources for the device. This approach will not work if the device has only GPIO as its resource or some custom resources. Remove zero resource check and allow platform device creation even without any valid IO resources. [rjw: Changelog] Signed-off-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/acpi')
-rw-r--r--drivers/acpi/acpi_platform.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/acpi/acpi_platform.c b/drivers/acpi/acpi_platform.c
index fafec5ddf17f..32136b85196d 100644
--- a/drivers/acpi/acpi_platform.c
+++ b/drivers/acpi/acpi_platform.c
@@ -52,7 +52,7 @@ int acpi_create_platform_device(struct acpi_device *adev,
52 struct platform_device_info pdevinfo; 52 struct platform_device_info pdevinfo;
53 struct resource_list_entry *rentry; 53 struct resource_list_entry *rentry;
54 struct list_head resource_list; 54 struct list_head resource_list;
55 struct resource *resources; 55 struct resource *resources = NULL;
56 int count; 56 int count;
57 57
58 /* If the ACPI node already has a physical device attached, skip it. */ 58 /* If the ACPI node already has a physical device attached, skip it. */
@@ -61,9 +61,12 @@ int acpi_create_platform_device(struct acpi_device *adev,
61 61
62 INIT_LIST_HEAD(&resource_list); 62 INIT_LIST_HEAD(&resource_list);
63 count = acpi_dev_get_resources(adev, &resource_list, NULL, NULL); 63 count = acpi_dev_get_resources(adev, &resource_list, NULL, NULL);
64 if (count <= 0) 64 if (count < 0)
65 return 0; 65 return 0;
66 66
67 if (!count)
68 goto create_dev;
69
67 resources = kmalloc(count * sizeof(struct resource), GFP_KERNEL); 70 resources = kmalloc(count * sizeof(struct resource), GFP_KERNEL);
68 if (!resources) { 71 if (!resources) {
69 dev_err(&adev->dev, "No memory for resources\n"); 72 dev_err(&adev->dev, "No memory for resources\n");
@@ -76,6 +79,7 @@ int acpi_create_platform_device(struct acpi_device *adev,
76 79
77 acpi_dev_free_resource_list(&resource_list); 80 acpi_dev_free_resource_list(&resource_list);
78 81
82create_dev:
79 memset(&pdevinfo, 0, sizeof(pdevinfo)); 83 memset(&pdevinfo, 0, sizeof(pdevinfo));
80 /* 84 /*
81 * If the ACPI node has a parent and that parent has a physical device 85 * If the ACPI node has a parent and that parent has a physical device