Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2707450imu; Sun, 27 Jan 2019 11:04:41 -0800 (PST) X-Google-Smtp-Source: ALg8bN5YvfkqNL+cl8+Fyz0AmIjnNZNPVRc7A685FUsfn9ZLUP2hmR+MNxBY3EIe+kjUuGt/Z0jF X-Received: by 2002:a17:902:3181:: with SMTP id x1mr18838409plb.58.1548615881602; Sun, 27 Jan 2019 11:04:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548615881; cv=none; d=google.com; s=arc-20160816; b=aOcRqht02sDmyGDI2XjLfVpT+WMpJACX5wk5OEPgyPdkh/26NGa5iTiJADOwRWbooI J5oU5zeZCSy0kRQM4kjkxWckJTKzlpSdl3oAtn4ycf0Tnxk1mXE/OpDZcF7jkNjZczSk yG+4LS+/S/KPy5FANPHxL1wLeN8lPs2Zqx0rbg7ZndsChLIk+aT3QuU+HlwdwbbIWBg7 t/CWv4IiUm3eXgglWTzuKpkaRHqSyHHYr3nEBl/DuM+TBKjf6yhkdawq8Tz/bdAodWF/ 8KpjqTqCksomixDY72UGRhiqCxvuFTnq53tyFQtgnA7wyROm3i3C1urKEw2rKXYJbo5w Bfgg== 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=roWj6zu0WkvC7Mdsj/u7cKuAclyqkPXg3FEFed2zjuY=; b=U+nfL7CMEFCPo8p4rUletkIQbuFOmbUMhNpO+JVgpwfye9CD8MYo3UvmrvvBARbfzP ReMPZor9TOJ4z/7n6fKFQX7J7XBYxa520b4Le/Fszh04WqGbZkJMSYNUNvT7GyQgB19M 9AOi2u28TQevhX/M6/hRmglMIpCXkFujoEKpuS0efkWl0KAW7/9c7YxIcqojC9TIZfVY sLLXR7i8nKyg/ms02MQfyIzc6gWpSkGDtHyqBSIQmyLvBJDCyg7XiWQZpJxQviOmN7H6 mHE/4E9GLt4Nph3mruwsT9Ik3BS+RSk5O6VpicJbbenyE1BK4B57C4rSBfcJ2cca0Dn9 2rKQ== 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 h9si6716351pgb.319.2019.01.27.11.04.26; Sun, 27 Jan 2019 11:04:41 -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 S1726999AbfA0TEJ (ORCPT + 99 others); Sun, 27 Jan 2019 14:04:09 -0500 Received: from proxy04.fsdata.se ([89.221.252.227]:33575 "EHLO mail-gw01.fsdata.se" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726878AbfA0TEJ (ORCPT ); Sun, 27 Jan 2019 14:04:09 -0500 Received: from localhost (94.234.44.129) by DAG01.HMC.local (192.168.46.11) with Microsoft SMTP Server (TLS) id 15.0.1263.5; Sun, 27 Jan 2019 20:03:55 +0100 From: Mattias Jacobsson <2pi@mok.nu> To: , CC: <2pi@mok.nu>, , Subject: [PATCH v2 1/3] platform/x86: wmi: move struct wmi_device_id to mod_devicetable.h Date: Sun, 27 Jan 2019 20:03:27 +0100 Message-ID: X-Mailer: git-send-email 2.20.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [94.234.44.129] X-ClientProxiedBy: PROXY04.HMC.local (192.168.46.54) 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 In preparation for adding WMI support to MODULE_DEVICE_TABLE() move the definition of struct wmi_device_id to mod_devicetable.h and inline guid_string in the struct. Changing guid_string to an inline char array changes the loop conditions when looping over an array of struct wmi_device_id. Therefore update wmi_dev_match()'s loop to check for an empty guid_string instead of a NULL pointer. Signed-off-by: Mattias Jacobsson <2pi@mok.nu> --- drivers/platform/x86/wmi.c | 2 +- include/linux/mod_devicetable.h | 13 +++++++++++++ include/linux/wmi.h | 5 +---- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/drivers/platform/x86/wmi.c b/drivers/platform/x86/wmi.c index c596479e8b13..5cb36b0e8b60 100644 --- a/drivers/platform/x86/wmi.c +++ b/drivers/platform/x86/wmi.c @@ -776,7 +776,7 @@ static int wmi_dev_match(struct device *dev, struct device_driver *driver) return 0; id = wmi_driver->id_table; - while (id->guid_string) { + while (id->guid_string[0] != '\0') { uuid_le driver_guid; if (WARN_ON(uuid_le_to_bin(id->guid_string, &driver_guid))) diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h index f9bd2f34b99f..ccc9bd4f32d2 100644 --- a/include/linux/mod_devicetable.h +++ b/include/linux/mod_devicetable.h @@ -779,4 +779,17 @@ struct typec_device_id { kernel_ulong_t driver_data; }; +/* WMI */ + +#define WMI_MODULE_PREFIX "wmi:" +#define WMI_GUID_STRING_LEN 36 + +/** + * struct wmi_device_id - WMI device identifier + * @guid_string: 36 char string of the form fa50ff2b-f2e8-45de-83fa-65417f2f49ba + */ +struct wmi_device_id { + const char guid_string[WMI_GUID_STRING_LEN+1]; +}; + #endif /* LINUX_MOD_DEVICETABLE_H */ diff --git a/include/linux/wmi.h b/include/linux/wmi.h index 4757cb5077e5..592f81afecbb 100644 --- a/include/linux/wmi.h +++ b/include/linux/wmi.h @@ -18,6 +18,7 @@ #include #include +#include #include struct wmi_device { @@ -39,10 +40,6 @@ extern union acpi_object *wmidev_block_query(struct wmi_device *wdev, extern int set_required_buffer_size(struct wmi_device *wdev, u64 length); -struct wmi_device_id { - const char *guid_string; -}; - struct wmi_driver { struct device_driver driver; const struct wmi_device_id *id_table; -- 2.20.1