diff options
| author | Mattias Jacobsson <[email protected]> | 2019-05-27 16:21:29 +0000 |
|---|---|---|
| committer | Andy Shevchenko <[email protected]> | 2019-06-17 12:22:47 +0000 |
| commit | a48e23385fcf397e69e2a75d72a81c545ec8bec2 (patch) | |
| tree | b6e0d215dac9ce32eb308ffe88c337c0b4d483e4 /drivers/platform/x86/wmi.c | |
| parent | platform/x86: asus-wmi: Do not disable keyboard backlight on unloading (diff) | |
| download | kernel-a48e23385fcf397e69e2a75d72a81c545ec8bec2.tar.gz kernel-a48e23385fcf397e69e2a75d72a81c545ec8bec2.zip | |
platform/x86: wmi: add context pointer field to struct wmi_device_id
When using wmi_install_notify_handler() to initialize a WMI handler a
data pointer can be supplied which will be passed on to the notification
handler. No similar feature exist when handling WMI events via struct
wmi_driver.
Add a context field pointer to struct wmi_device_id and add a function
find_guid_context() to retrieve that context pointer.
Signed-off-by: Mattias Jacobsson <[email protected]>
Signed-off-by: Andy Shevchenko <[email protected]>
Diffstat (limited to 'drivers/platform/x86/wmi.c')
| -rw-r--r-- | drivers/platform/x86/wmi.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/drivers/platform/x86/wmi.c b/drivers/platform/x86/wmi.c index b08ffb769cbe..f3be1c008856 100644 --- a/drivers/platform/x86/wmi.c +++ b/drivers/platform/x86/wmi.c @@ -146,6 +146,28 @@ static bool find_guid(const char *guid_string, struct wmi_block **out) return false; } +static const void *find_guid_context(struct wmi_block *wblock, + struct wmi_driver *wdriver) +{ + const struct wmi_device_id *id; + uuid_le guid_input; + + if (wblock == NULL || wdriver == NULL) + return NULL; + if (wdriver->id_table == NULL) + return NULL; + + id = wdriver->id_table; + while (*id->guid_string) { + if (uuid_le_to_bin(id->guid_string, &guid_input)) + continue; + if (!memcmp(wblock->gblock.guid, &guid_input, 16)) + return id->context; + id++; + } + return NULL; +} + static int get_subobj_info(acpi_handle handle, const char *pathname, struct acpi_device_info **info) { |
