resource.c (033d777f548645c3a906b73eef5d665aeee55092) | resource.c (952c63e9512b63220886105cfc791507046fa39a) |
---|---|
1/* 2 * drivers/acpi/resource.c - ACPI device resources interpretation. 3 * 4 * Copyright (C) 2012, Intel Corp. 5 * Author: Rafael J. Wysocki <rafael.j.wysocki@intel.com> 6 * 7 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 8 * --- 491 unchanged lines hidden (view full) --- 500 * The number of resources in the output list is returned on success, an error 501 * code reflecting the error condition is returned otherwise. 502 */ 503int acpi_dev_get_resources(struct acpi_device *adev, struct list_head *list, 504 int (*preproc)(struct acpi_resource *, void *), 505 void *preproc_data) 506{ 507 struct res_proc_context c; | 1/* 2 * drivers/acpi/resource.c - ACPI device resources interpretation. 3 * 4 * Copyright (C) 2012, Intel Corp. 5 * Author: Rafael J. Wysocki <rafael.j.wysocki@intel.com> 6 * 7 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 8 * --- 491 unchanged lines hidden (view full) --- 500 * The number of resources in the output list is returned on success, an error 501 * code reflecting the error condition is returned otherwise. 502 */ 503int acpi_dev_get_resources(struct acpi_device *adev, struct list_head *list, 504 int (*preproc)(struct acpi_resource *, void *), 505 void *preproc_data) 506{ 507 struct res_proc_context c; |
508 acpi_handle not_used; | |
509 acpi_status status; 510 511 if (!adev || !adev->handle || !list_empty(list)) 512 return -EINVAL; 513 | 508 acpi_status status; 509 510 if (!adev || !adev->handle || !list_empty(list)) 511 return -EINVAL; 512 |
514 status = acpi_get_handle(adev->handle, METHOD_NAME__CRS, ¬_used); 515 if (ACPI_FAILURE(status)) | 513 if (!acpi_has_method(adev->handle, METHOD_NAME__CRS)) |
516 return 0; 517 518 c.list = list; 519 c.preproc = preproc; 520 c.preproc_data = preproc_data; 521 c.count = 0; 522 c.error = 0; 523 status = acpi_walk_resources(adev->handle, METHOD_NAME__CRS, 524 acpi_dev_process_resource, &c); 525 if (ACPI_FAILURE(status)) { 526 acpi_dev_free_resource_list(list); 527 return c.error ? c.error : -EIO; 528 } 529 530 return c.count; 531} 532EXPORT_SYMBOL_GPL(acpi_dev_get_resources); | 514 return 0; 515 516 c.list = list; 517 c.preproc = preproc; 518 c.preproc_data = preproc_data; 519 c.count = 0; 520 c.error = 0; 521 status = acpi_walk_resources(adev->handle, METHOD_NAME__CRS, 522 acpi_dev_process_resource, &c); 523 if (ACPI_FAILURE(status)) { 524 acpi_dev_free_resource_list(list); 525 return c.error ? c.error : -EIO; 526 } 527 528 return c.count; 529} 530EXPORT_SYMBOL_GPL(acpi_dev_get_resources); |