Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp4024777ybi; Mon, 27 May 2019 09:38:30 -0700 (PDT) X-Google-Smtp-Source: APXvYqwglx09UETy1DsCWgSyA27XPM2y4/THW1nvIVSAB4E1MeSD8yNo/AmQqeDiqK2/8lgMjorV X-Received: by 2002:a17:902:9689:: with SMTP id n9mr129663608plp.133.1558975110897; Mon, 27 May 2019 09:38:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558975110; cv=none; d=google.com; s=arc-20160816; b=h2S+TeCV/t0Mo4u0gufP279S1nFjiHJlM1Z0QWDKxi21k3SUonU4n7AsBp28g0gjNU K4J53CX+lVaU9rhocBNEVI/M7C+g9bB6IjaKxII6VFEGkFPTwreVoTA75cwSzXy9NSA7 84+N+z2ZPvPzKhLhHlJTsdy+2lXrrH9lKtDqRHHEXhrVthSTq/7znXGY1HkuO9VEhMl/ i7xcumtDFEomcKQ6yuIcANb7ZGcfNed3Tm5kQDQaO+e+30o0l6ePL2M2Uvw3m3gN/dHg qevn9rfN+csaKewu3J/dRcHBiC7+DUOiNWcPBmee12Z6nU/ksEeuowS2Nga1me50p2uR bYzg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=9UcbdryJX7Bym8uwkUhAuKBQ6qhdTi4nPtfe/2OPRWM=; b=HrND0nOC7pGxJI9ZJYPWJAmiY5WUZv3NQZLwezmVyJhmUrWO3sGFWbKkYA+nQueP5z +354GgoXw3H8ZqhtHn/zbBhxKma8nt8r5ADmdmrG0ULQKoUA64Q+TAqINgS31XuuXXxb hV2bWgcnlQnRQia8Wp05a7Km0qcND1BMvHq70NBob4Aa5MGVg1yNeeRmctlSz9FJakMB pfTM7phHrWrVUTQ7E//NjUou3BihhsX7Gi+T5d/kaatmo0WVWs5dChMSpRDz7ga7Jduy dIgGS7zSPYeDp9hwtm2S/C5Fyn8INP20HeIMoEGB/LI6hBrCeFFukZppMriN19yKmB6i YVfQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mok.nu Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k17si21941044pfd.278.2019.05.27.09.38.16; Mon, 27 May 2019 09:38:30 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mok.nu Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726866AbfE0QhK (ORCPT + 99 others); Mon, 27 May 2019 12:37:10 -0400 Received: from proxy04.fsdata.se ([89.221.252.227]:50417 "EHLO mail-gw01.fsdata.se" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726704AbfE0QhI (ORCPT ); Mon, 27 May 2019 12:37:08 -0400 X-Greylist: delayed 911 seconds by postgrey-1.27 at vger.kernel.org; Mon, 27 May 2019 12:37:03 EDT Received: from localhost (94.234.40.49) by DAG01.HMC.local (192.168.46.11) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Mon, 27 May 2019 18:21:48 +0200 From: Mattias Jacobsson <2pi@mok.nu> To: , CC: <2pi@mok.nu>, , Subject: [PATCH 1/3] platform/x86: wmi: add context pointer field to struct wmi_device_id Date: Mon, 27 May 2019 18:21:29 +0200 Message-ID: X-Mailer: git-send-email 2.21.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [94.234.40.49] X-ClientProxiedBy: PROXY02.HMC.local (192.168.46.52) To DAG01.HMC.local (192.168.46.11) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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> --- drivers/platform/x86/wmi.c | 22 ++++++++++++++++++++++ include/linux/mod_devicetable.h | 1 + 2 files changed, 23 insertions(+) diff --git a/drivers/platform/x86/wmi.c b/drivers/platform/x86/wmi.c index 7b26b6ccf1a0..f41f1410da9d 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) { diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h index 448621c32e4d..09366859aac2 100644 --- a/include/linux/mod_devicetable.h +++ b/include/linux/mod_devicetable.h @@ -798,6 +798,7 @@ struct tee_client_device_id { */ struct wmi_device_id { const char guid_string[UUID_STRING_LEN+1]; + const void *context; }; #endif /* LINUX_MOD_DEVICETABLE_H */ -- 2.21.0