diff options
| author | Jiang Liu <jiang.liu@linux.intel.com> | 2013-12-19 07:38:10 -0500 |
|---|---|---|
| committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2014-01-05 10:07:14 -0500 |
| commit | a65ac52041cccaf598995bc44340849027f1d79b (patch) | |
| tree | 66feec04a0a904218e076cae1296dd3bbad862f6 /include/acpi/acpi_bus.h | |
| parent | e73be4a78b500374a1c42810dc073189036b4dd8 (diff) | |
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>
Diffstat (limited to 'include/acpi/acpi_bus.h')
| -rw-r--r-- | include/acpi/acpi_bus.h | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h index ddabed1f51c2..dd9b5edc7630 100644 --- a/include/acpi/acpi_bus.h +++ b/include/acpi/acpi_bus.h | |||
| @@ -66,6 +66,32 @@ bool acpi_ata_match(acpi_handle handle); | |||
| 66 | bool acpi_bay_match(acpi_handle handle); | 66 | bool acpi_bay_match(acpi_handle handle); |
| 67 | bool acpi_dock_match(acpi_handle handle); | 67 | bool acpi_dock_match(acpi_handle handle); |
| 68 | 68 | ||
| 69 | bool acpi_check_dsm(acpi_handle handle, const u8 *uuid, int rev, u64 funcs); | ||
| 70 | union acpi_object *acpi_evaluate_dsm(acpi_handle handle, const u8 *uuid, | ||
| 71 | int rev, int func, union acpi_object *argv4); | ||
| 72 | |||
| 73 | static inline union acpi_object * | ||
| 74 | acpi_evaluate_dsm_typed(acpi_handle handle, const u8 *uuid, int rev, int func, | ||
| 75 | union acpi_object *argv4, acpi_object_type type) | ||
| 76 | { | ||
| 77 | union acpi_object *obj; | ||
| 78 | |||
| 79 | obj = acpi_evaluate_dsm(handle, uuid, rev, func, argv4); | ||
| 80 | if (obj && obj->type != type) { | ||
| 81 | ACPI_FREE(obj); | ||
| 82 | obj = NULL; | ||
| 83 | } | ||
| 84 | |||
| 85 | return obj; | ||
| 86 | } | ||
| 87 | |||
| 88 | #define ACPI_INIT_DSM_ARGV4(cnt, eles) \ | ||
| 89 | { \ | ||
| 90 | .package.type = ACPI_TYPE_PACKAGE, \ | ||
| 91 | .package.count = (cnt), \ | ||
| 92 | .package.elements = (eles) \ | ||
| 93 | } | ||
| 94 | |||
| 69 | #ifdef CONFIG_ACPI | 95 | #ifdef CONFIG_ACPI |
| 70 | 96 | ||
| 71 | #include <linux/proc_fs.h> | 97 | #include <linux/proc_fs.h> |
