summaryrefslogtreecommitdiffstats
path: root/drivers/acpi/utils.c
diff options
context:
space:
mode:
authorJiang Liu <jiang.liu@huawei.com>2013-06-29 00:24:38 +0800
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2013-07-15 01:33:10 +0200
commit952c63e9512b63220886105cfc791507046fa39a (patch)
treebf3bd0592ea0fac74418fe16b8a4125e2db799ea /drivers/acpi/utils.c
parent472d963befe28b8614ea2789757b27536c8d79eb (diff)
downloadop-kernel-dev-952c63e9512b63220886105cfc791507046fa39a.zip
op-kernel-dev-952c63e9512b63220886105cfc791507046fa39a.tar.gz
ACPI: introduce helper function acpi_has_method()
Introduce helper function acpi_has_method() and use it in a number of places to simplify code. [rjw: Changelog] Signed-off-by: Jiang Liu <jiang.liu@huawei.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/acpi/utils.c')
-rw-r--r--drivers/acpi/utils.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/drivers/acpi/utils.c b/drivers/acpi/utils.c
index 74437130..b08d973 100644
--- a/drivers/acpi/utils.c
+++ b/drivers/acpi/utils.c
@@ -495,3 +495,18 @@ acpi_handle_printk(const char *level, acpi_handle handle, const char *fmt, ...)
kfree(buffer.pointer);
}
EXPORT_SYMBOL(acpi_handle_printk);
+
+/**
+ * acpi_has_method: Check whether @handle has a method named @name
+ * @handle: ACPI device handle
+ * @name: name of object or method
+ *
+ * Check whether @handle has a method named @name.
+ */
+bool acpi_has_method(acpi_handle handle, char *name)
+{
+ acpi_handle tmp;
+
+ return ACPI_SUCCESS(acpi_get_handle(handle, name, &tmp));
+}
+EXPORT_SYMBOL(acpi_has_method);
OpenPOWER on IntegriCloud