diff options
author | Mattias Jacobsson <2pi@mok.nu> | 2019-02-19 14:59:49 -0500 |
---|---|---|
committer | Darren Hart (VMware) <dvhart@infradead.org> | 2019-03-07 11:46:07 -0500 |
commit | eacc95eae6837d3f41aed7d30b855a79ab2cb101 (patch) | |
tree | 7626e82bcc2d50f90555db0535eddf3ab64728cc | |
parent | 841f1b8fb4ca5e296e0ecb2b13f2a679d912ec4d (diff) |
platform/x86: wmi: move struct wmi_device_id to mod_devicetable.h
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>
-rw-r--r-- | drivers/platform/x86/wmi.c | 2 | ||||
-rw-r--r-- | include/linux/mod_devicetable.h | 12 | ||||
-rw-r--r-- | include/linux/wmi.h | 5 | ||||
-rw-r--r-- | scripts/mod/file2alias.c | 1 |
4 files changed, 15 insertions, 5 deletions
diff --git a/drivers/platform/x86/wmi.c b/drivers/platform/x86/wmi.c index b0f3d8ecd898..7b26b6ccf1a0 100644 --- a/drivers/platform/x86/wmi.c +++ b/drivers/platform/x86/wmi.c | |||
@@ -771,7 +771,7 @@ static int wmi_dev_match(struct device *dev, struct device_driver *driver) | |||
771 | if (id == NULL) | 771 | if (id == NULL) |
772 | return 0; | 772 | return 0; |
773 | 773 | ||
774 | while (id->guid_string) { | 774 | while (*id->guid_string) { |
775 | uuid_le driver_guid; | 775 | uuid_le driver_guid; |
776 | 776 | ||
777 | if (WARN_ON(uuid_le_to_bin(id->guid_string, &driver_guid))) | 777 | 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..e44b90fa0aef 100644 --- a/include/linux/mod_devicetable.h +++ b/include/linux/mod_devicetable.h | |||
@@ -779,4 +779,16 @@ struct typec_device_id { | |||
779 | kernel_ulong_t driver_data; | 779 | kernel_ulong_t driver_data; |
780 | }; | 780 | }; |
781 | 781 | ||
782 | /* WMI */ | ||
783 | |||
784 | #define WMI_MODULE_PREFIX "wmi:" | ||
785 | |||
786 | /** | ||
787 | * struct wmi_device_id - WMI device identifier | ||
788 | * @guid_string: 36 char string of the form fa50ff2b-f2e8-45de-83fa-65417f2f49ba | ||
789 | */ | ||
790 | struct wmi_device_id { | ||
791 | const char guid_string[UUID_STRING_LEN+1]; | ||
792 | }; | ||
793 | |||
782 | #endif /* LINUX_MOD_DEVICETABLE_H */ | 794 | #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 @@ | |||
18 | 18 | ||
19 | #include <linux/device.h> | 19 | #include <linux/device.h> |
20 | #include <linux/acpi.h> | 20 | #include <linux/acpi.h> |
21 | #include <linux/mod_devicetable.h> | ||
21 | #include <uapi/linux/wmi.h> | 22 | #include <uapi/linux/wmi.h> |
22 | 23 | ||
23 | struct wmi_device { | 24 | struct wmi_device { |
@@ -39,10 +40,6 @@ extern union acpi_object *wmidev_block_query(struct wmi_device *wdev, | |||
39 | 40 | ||
40 | extern int set_required_buffer_size(struct wmi_device *wdev, u64 length); | 41 | extern int set_required_buffer_size(struct wmi_device *wdev, u64 length); |
41 | 42 | ||
42 | struct wmi_device_id { | ||
43 | const char *guid_string; | ||
44 | }; | ||
45 | |||
46 | struct wmi_driver { | 43 | struct wmi_driver { |
47 | struct device_driver driver; | 44 | struct device_driver driver; |
48 | const struct wmi_device_id *id_table; | 45 | const struct wmi_device_id *id_table; |
diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c index afe22af20d7d..4e4f03a12cc0 100644 --- a/scripts/mod/file2alias.c +++ b/scripts/mod/file2alias.c | |||
@@ -37,6 +37,7 @@ typedef unsigned char __u8; | |||
37 | typedef struct { | 37 | typedef struct { |
38 | __u8 b[16]; | 38 | __u8 b[16]; |
39 | } uuid_le; | 39 | } uuid_le; |
40 | #define UUID_STRING_LEN 36 | ||
40 | 41 | ||
41 | /* Big exception to the "don't include kernel headers into userspace, which | 42 | /* Big exception to the "don't include kernel headers into userspace, which |
42 | * even potentially has different endianness and word sizes, since | 43 | * even potentially has different endianness and word sizes, since |