mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 19:51:31 -04:00
ACPI: Add _PLD support
Add a simple helper function to allow drivers to obtain the physical device location data. Acked-by: Len Brown <[email protected]> Signed-off-by: Matthew Garrett <[email protected]> Signed-off-by: Lan Tianyu <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
This commit is contained in:
parent
66886d6f8c
commit
38ac0f1b90
2 changed files with 61 additions and 0 deletions
|
|
@ -382,3 +382,33 @@ acpi_evaluate_reference(acpi_handle handle,
|
|||
}
|
||||
|
||||
EXPORT_SYMBOL(acpi_evaluate_reference);
|
||||
|
||||
acpi_status
|
||||
acpi_get_physical_device_location(acpi_handle handle, struct acpi_pld *pld)
|
||||
{
|
||||
acpi_status status;
|
||||
struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
|
||||
union acpi_object *output;
|
||||
|
||||
status = acpi_evaluate_object(handle, "_PLD", NULL, &buffer);
|
||||
|
||||
if (ACPI_FAILURE(status))
|
||||
return status;
|
||||
|
||||
output = buffer.pointer;
|
||||
|
||||
if (!output || output->type != ACPI_TYPE_PACKAGE
|
||||
|| !output->package.count
|
||||
|| output->package.elements[0].type != ACPI_TYPE_BUFFER
|
||||
|| output->package.elements[0].buffer.length > sizeof(*pld)) {
|
||||
status = AE_TYPE;
|
||||
goto out;
|
||||
}
|
||||
|
||||
memcpy(pld, output->package.elements[0].buffer.pointer,
|
||||
output->package.elements[0].buffer.length);
|
||||
out:
|
||||
kfree(buffer.pointer);
|
||||
return status;
|
||||
}
|
||||
EXPORT_SYMBOL(acpi_get_physical_device_location);
|
||||
|
|
|
|||
Loading…
Reference in a new issue