aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/platform/x86/wmi.c
diff options
context:
space:
mode:
authorMattias Jacobsson <2pi@mok.nu>2019-05-27 12:21:29 -0400
committerAndy Shevchenko <andriy.shevchenko@linux.intel.com>2019-06-17 08:22:47 -0400
commita48e23385fcf397e69e2a75d72a81c545ec8bec2 (patch)
treeb6e0d215dac9ce32eb308ffe88c337c0b4d483e4 /drivers/platform/x86/wmi.c
parent3e58167ac3703c9b15a8600ab559d239f3d4dd97 (diff)
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 <2pi@mok.nu> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Diffstat (limited to 'drivers/platform/x86/wmi.c')
-rw-r--r--drivers/platform/x86/wmi.c22
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)
146 return false; 146 return false;
147} 147}
148 148
149static const void *find_guid_context(struct wmi_block *wblock,
150 struct wmi_driver *wdriver)
151{
152 const struct wmi_device_id *id;
153 uuid_le guid_input;
154
155 if (wblock == NULL || wdriver == NULL)
156 return NULL;
157 if (wdriver->id_table == NULL)
158 return NULL;
159
160 id = wdriver->id_table;
161 while (*id->guid_string) {
162 if (uuid_le_to_bin(id->guid_string, &guid_input))
163 continue;
164 if (!memcmp(wblock->gblock.guid, &guid_input, 16))
165 return id->context;
166 id++;
167 }
168 return NULL;
169}
170
149static int get_subobj_info(acpi_handle handle, const char *pathname, 171static int get_subobj_info(acpi_handle handle, const char *pathname,
150 struct acpi_device_info **info) 172 struct acpi_device_info **info)
151{ 173{