Skip to content

Commit

Permalink
ACPI / scan: Allow platform device creation without any IO resources
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Kuppuswamy Sathyanarayanan authored and Rafael J. Wysocki committed Aug 6, 2013
1 parent 1129c92 commit 62eb4b0
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions drivers/acpi/acpi_platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ int acpi_create_platform_device(struct acpi_device *adev,
struct platform_device_info pdevinfo;
struct resource_list_entry *rentry;
struct list_head resource_list;
struct resource *resources;
struct resource *resources = NULL;
int count;

/* If the ACPI node already has a physical device attached, skip it. */
Expand All @@ -61,9 +61,12 @@ int 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)
if (count < 0)
return 0;

if (!count)
goto create_dev;

resources = kmalloc(count * sizeof(struct resource), GFP_KERNEL);
if (!resources) {
dev_err(&adev->dev, "No memory for resources\n");
Expand All @@ -76,6 +79,7 @@ int acpi_create_platform_device(struct acpi_device *adev,

acpi_dev_free_resource_list(&resource_list);

create_dev:
memset(&pdevinfo, 0, sizeof(pdevinfo));
/*
* If the ACPI node has a parent and that parent has a physical device
Expand Down

0 comments on commit 62eb4b0

Please sign in to comment.