platform/x86: wmi: move struct wmi_device_id to mod_devicetable.h
authorMattias Jacobsson <2pi@mok.nu>
Tue, 19 Feb 2019 19:59:49 +0000 (20:59 +0100)
committerDarren Hart (VMware) <dvhart@infradead.org>
Thu, 7 Mar 2019 16:46:07 +0000 (08:46 -0800)
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>
[dvhart: Move UUID_STRING_LEN define to this patch]
Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
drivers/platform/x86/wmi.c
include/linux/mod_devicetable.h
include/linux/wmi.h
scripts/mod/file2alias.c

index b0f3d8e..7b26b6c 100644 (file)
@@ -771,7 +771,7 @@ static int wmi_dev_match(struct device *dev, struct device_driver *driver)
        if (id == NULL)
                return 0;
 
-       while (id->guid_string) {
+       while (*id->guid_string) {
                uuid_le driver_guid;
 
                if (WARN_ON(uuid_le_to_bin(id->guid_string, &driver_guid)))
index f9bd2f3..e44b90f 100644 (file)
@@ -779,4 +779,16 @@ struct typec_device_id {
        kernel_ulong_t driver_data;
 };
 
+/* WMI */
+
+#define WMI_MODULE_PREFIX      "wmi:"
+
+/**
+ * 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[UUID_STRING_LEN+1];
+};
+
 #endif /* LINUX_MOD_DEVICETABLE_H */
index 4757cb5..592f81a 100644 (file)
@@ -18,6 +18,7 @@
 
 #include <linux/device.h>
 #include <linux/acpi.h>
+#include <linux/mod_devicetable.h>
 #include <uapi/linux/wmi.h>
 
 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;
index afe22af..4e4f03a 100644 (file)
@@ -37,6 +37,7 @@ typedef unsigned char __u8;
 typedef struct {
        __u8 b[16];
 } uuid_le;
+#define        UUID_STRING_LEN         36
 
 /* Big exception to the "don't include kernel headers into userspace, which
  * even potentially has different endianness and word sizes, since