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 <jiang.liu@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
This commit is contained in:
Jiang Liu
2013-12-19 20:38:10 +08:00
committed by Rafael J. Wysocki
parent e73be4a78b
commit a65ac52041
2 changed files with 123 additions and 0 deletions

View File

@@ -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>