Commit 722c856d authored by Mario Limonciello's avatar Mario Limonciello Committed by Darren Hart (VMware)

platform/x86: wmi: Add new method wmidev_evaluate_method

Drivers properly using the wmibus can pass their wmi_device
pointer rather than the GUID back to the WMI bus to evaluate
the proper methods.

Any "new" drivers added that use the WMI bus should use this
rather than the old wmi_evaluate_method that would take the
GUID.
Signed-off-by: default avatarMario Limonciello <mario.limonciello@dell.com>
Reviewed-by: default avatarEdward O'Callaghan <quasisec@google.com>
Reviewed-by: default avatarPali Rohár <pali.rohar@gmail.com>
Signed-off-by: default avatarDarren Hart (VMware) <dvhart@infradead.org>
parent f35a8efe
...@@ -200,6 +200,28 @@ static acpi_status wmi_method_enable(struct wmi_block *wblock, int enable) ...@@ -200,6 +200,28 @@ static acpi_status wmi_method_enable(struct wmi_block *wblock, int enable)
*/ */
acpi_status wmi_evaluate_method(const char *guid_string, u8 instance, acpi_status wmi_evaluate_method(const char *guid_string, u8 instance,
u32 method_id, const struct acpi_buffer *in, struct acpi_buffer *out) u32 method_id, const struct acpi_buffer *in, struct acpi_buffer *out)
{
struct wmi_block *wblock = NULL;
if (!find_guid(guid_string, &wblock))
return AE_ERROR;
return wmidev_evaluate_method(&wblock->dev, instance, method_id,
in, out);
}
EXPORT_SYMBOL_GPL(wmi_evaluate_method);
/**
* wmidev_evaluate_method - Evaluate a WMI method
* @wdev: A wmi bus device from a driver
* @instance: Instance index
* @method_id: Method ID to call
* &in: Buffer containing input for the method call
* &out: Empty buffer to return the method results
*
* Call an ACPI-WMI method
*/
acpi_status wmidev_evaluate_method(struct wmi_device *wdev, u8 instance,
u32 method_id, const struct acpi_buffer *in, struct acpi_buffer *out)
{ {
struct guid_block *block = NULL; struct guid_block *block = NULL;
struct wmi_block *wblock = NULL; struct wmi_block *wblock = NULL;
...@@ -209,9 +231,7 @@ u32 method_id, const struct acpi_buffer *in, struct acpi_buffer *out) ...@@ -209,9 +231,7 @@ u32 method_id, const struct acpi_buffer *in, struct acpi_buffer *out)
union acpi_object params[3]; union acpi_object params[3];
char method[5] = "WM"; char method[5] = "WM";
if (!find_guid(guid_string, &wblock)) wblock = container_of(wdev, struct wmi_block, dev);
return AE_ERROR;
block = &wblock->gblock; block = &wblock->gblock;
handle = wblock->acpi_device->handle; handle = wblock->acpi_device->handle;
...@@ -246,7 +266,7 @@ u32 method_id, const struct acpi_buffer *in, struct acpi_buffer *out) ...@@ -246,7 +266,7 @@ u32 method_id, const struct acpi_buffer *in, struct acpi_buffer *out)
return status; return status;
} }
EXPORT_SYMBOL_GPL(wmi_evaluate_method); EXPORT_SYMBOL_GPL(wmidev_evaluate_method);
static acpi_status __query_block(struct wmi_block *wblock, u8 instance, static acpi_status __query_block(struct wmi_block *wblock, u8 instance,
struct acpi_buffer *out) struct acpi_buffer *out)
......
...@@ -26,6 +26,12 @@ struct wmi_device { ...@@ -26,6 +26,12 @@ struct wmi_device {
bool setable; bool setable;
}; };
/* evaluate the ACPI method associated with this device */
extern acpi_status wmidev_evaluate_method(struct wmi_device *wdev,
u8 instance, u32 method_id,
const struct acpi_buffer *in,
struct acpi_buffer *out);
/* Caller must kfree the result. */ /* Caller must kfree the result. */
extern union acpi_object *wmidev_block_query(struct wmi_device *wdev, extern union acpi_object *wmidev_block_query(struct wmi_device *wdev,
u8 instance); u8 instance);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment