mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 11:11:45 -04:00
ACPI: introduce helper interfaces for _DSM method
There are several drivers making use of ACPI _DSM method to detect and invoke device specific methods. Currently every driver has implemented its private version to support ACPI _DSM method. So this patch introduces three helper functions to support ACPI _DSM method, which will be used to replace open-coded versions. It helps to simplify code and improve code readability. Signed-off-by: Jiang Liu <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
This commit is contained in:
parent
e73be4a78b
commit
a65ac52041
2 changed files with 123 additions and 0 deletions
|
|
@ -66,6 +66,32 @@ bool acpi_ata_match(acpi_handle handle);
|
|||
bool acpi_bay_match(acpi_handle handle);
|
||||
bool acpi_dock_match(acpi_handle handle);
|
||||
|
||||
bool acpi_check_dsm(acpi_handle handle, const u8 *uuid, int rev, u64 funcs);
|
||||
union acpi_object *acpi_evaluate_dsm(acpi_handle handle, const u8 *uuid,
|
||||
int rev, int func, union acpi_object *argv4);
|
||||
|
||||
static inline union acpi_object *
|
||||
acpi_evaluate_dsm_typed(acpi_handle handle, const u8 *uuid, int rev, int func,
|
||||
union acpi_object *argv4, acpi_object_type type)
|
||||
{
|
||||
union acpi_object *obj;
|
||||
|
||||
obj = acpi_evaluate_dsm(handle, uuid, rev, func, argv4);
|
||||
if (obj && obj->type != type) {
|
||||
ACPI_FREE(obj);
|
||||
obj = NULL;
|
||||
}
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
#define ACPI_INIT_DSM_ARGV4(cnt, eles) \
|
||||
{ \
|
||||
.package.type = ACPI_TYPE_PACKAGE, \
|
||||
.package.count = (cnt), \
|
||||
.package.elements = (eles) \
|
||||
}
|
||||
|
||||
#ifdef CONFIG_ACPI
|
||||
|
||||
#include <linux/proc_fs.h>
|
||||
|
|
|
|||
Loading…
Reference in a new issue