Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp4169719imu; Sat, 19 Jan 2019 03:58:30 -0800 (PST) X-Google-Smtp-Source: ALg8bN6ojU5DaOqb+sAWaAtCMfVxpmgd+HD8p1e0kQAXjGDUdBWl+40fx8Dor21dJNuG0WsJ560K X-Received: by 2002:a17:902:8ec8:: with SMTP id x8mr22878781plo.210.1547899110576; Sat, 19 Jan 2019 03:58:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547899110; cv=none; d=google.com; s=arc-20160816; b=0dCJGuAR8xlWEG4/3jo3Yzc7GK9GrDcoCp4wk7gqVAurjn9/7lwM4LI3409dYYxrxQ 1GRy7cBlqwFvT73vIzqPgv8btOAlDTntfRJzeE8dF7BQYu/oL32sjoLRT+qpXh8WmT+G PdzxfzrUjkymxusPSSPbh7Xo8mtK4NZO6hITJMVX2RkKbpRXA52PKAqjMhJyh3KyG0nW 8AwtqwUg/EI4zpv3i96/NlOYH7Ue84/w1fiyCHhBXKy7Qn+zDiDmnlY5sGbiSQ92R3XM Vyu7siEaLZIDXpqNUIOER25ggLuONaXlJh5YxfLS4KTnV/oO5heDO0wSlN3V82OvMV3r RcaQ== 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=0TqkEEq3wOps1SThzu5EOQX9OpeaMuMkKclDsiUXzzI=; b=QuDbe9OLsJgjANyR0itXB1t5CZjOtfKMV7hf0ooOIK+jD3BscOB10q1iWgC0LAI4w4 n4G7E2kt/2NQLcqKdkjkssiS9adSP8r60AmaGoRSoQZSo7nqCxnxzRWnsua5iNyal0oI ZniABy1H0kMQiIUfvaOjni0s4zdnGPpPHjt22SqdRd9aZzn3kOLdlyqobofraU39bzGX yCmeUdXCwggiGKxDnQOSxhQjRRhWX1lmRR0LKep2M3EddIiRbl1ErHlrh2PzH3rAEtll nF9y52wL5jGjuAqlUAD2EUS68sIkA9Ylbo2uxJK8DzuJ7VODCoAK8A1h28kVnIIDq9Xm 0OTw== 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 x61si7215053plb.303.2019.01.19.03.58.12; Sat, 19 Jan 2019 03:58:30 -0800 (PST) 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 S1728050AbfASL4k (ORCPT + 99 others); Sat, 19 Jan 2019 06:56:40 -0500 Received: from route-level1.fsdata.se ([89.221.252.216]:30728 "EHLO route-level1.fsdata.se" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727868AbfASL4k (ORCPT ); Sat, 19 Jan 2019 06:56:40 -0500 Received: from DAG01.HMC.local (192.168.46.11) by EDGE01LEVEL1.hmc.local (192.168.46.33) with Microsoft SMTP Server (TLS) id 15.0.847.32; Sat, 19 Jan 2019 12:56:13 +0100 Received: from localhost (94.234.47.42) by DAG01.HMC.local (192.168.46.11) with Microsoft SMTP Server (TLS) id 15.0.1263.5; Sat, 19 Jan 2019 12:56:16 +0100 From: Mattias Jacobsson <2pi@mok.nu> To: , , , , CC: <2pi@mok.nu>, , Subject: [PATCH 2/3] platform/x86: wmi: add WMI support to MODULE_DEVICE_TABLE() Date: Sat, 19 Jan 2019 12:55:54 +0100 Message-ID: X-Mailer: git-send-email 2.20.1 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-Originating-IP: [94.234.47.42] X-ClientProxiedBy: PROXY05.HMC.local (192.168.46.55) To DAG01.HMC.local (192.168.46.11) Received-SPF: Neutral (EDGE01LEVEL1.hmc.local: 192.168.46.11 is neither permitted nor denied by domain of 2pi@mok.nu) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add WMI support to MODULE_DEVICE_TABLE() by adding info about struct wmi_device_id in devicetable-offsets.c and add a WMI entry point in file2alias.c. The type argument for MODULE_DEVICE_TABLE(type, name) is wmi. Signed-off-by: Mattias Jacobsson <2pi@mok.nu> --- The idea of adding wmi support to MODULE_DEVICE_TABLE() originates from a suggestion at [1]. However [2] states: "Please note that this tag should not be added without the reporter's permission, especially if the idea was not posted in a public forum." about the "Suggested-by:" tag. Pali Rohár: May I add a "Suggested-by:" tag? [1]: https://lore.kernel.org/patchwork/patch/795892/#989423 [2]: Documentation/process/submitting-patches.rst --- scripts/mod/devicetable-offsets.c | 3 +++ scripts/mod/file2alias.c | 18 ++++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/scripts/mod/devicetable-offsets.c b/scripts/mod/devicetable-offsets.c index 293004499b4d..99276a422e77 100644 --- a/scripts/mod/devicetable-offsets.c +++ b/scripts/mod/devicetable-offsets.c @@ -225,5 +225,8 @@ int main(void) DEVID_FIELD(typec_device_id, svid); DEVID_FIELD(typec_device_id, mode); + DEVID(wmi_device_id); + DEVID_FIELD(wmi_device_id, guid_string); + return 0; } diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c index a37af7d71973..f014a2466ff7 100644 --- a/scripts/mod/file2alias.c +++ b/scripts/mod/file2alias.c @@ -1287,6 +1287,23 @@ static int do_typec_entry(const char *filename, void *symval, char *alias) return 1; } +/* Looks like: wmi:guid */ +static int do_wmi_entry(const char *filename, void *symval, char *alias) +{ + DEF_FIELD_ADDR(symval, wmi_device_id, guid_string); + if (strlen(*guid_string) != WMI_GUID_STRING_LEN) { + warn("Invalid WMI device id 'wmi:%s' in '%s'\n", + *guid_string, filename); + return 0; + } + if (snprintf(alias, 500, WMI_MODULE_PREFIX "%s", *guid_string) < 0) { + warn("Could not generate all MODULE_ALIAS's in '%s'\n", + filename); + return 0; + } + return 1; +} + /* Does namelen bytes of name exactly match the symbol? */ static bool sym_is(const char *name, unsigned namelen, const char *symbol) { @@ -1357,6 +1374,7 @@ static const struct devtable devtable[] = { {"fslmc", SIZE_fsl_mc_device_id, do_fsl_mc_entry}, {"tbsvc", SIZE_tb_service_id, do_tbsvc_entry}, {"typec", SIZE_typec_device_id, do_typec_entry}, + {"wmi", SIZE_wmi_device_id, do_wmi_entry}, }; /* Create MODULE_ALIAS() statements. -- 2.20.1