Skip to content

Commit eacc95e

Browse files
2pidvhart
authored andcommitted
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>
1 parent 841f1b8 commit eacc95e

4 files changed

Lines changed: 15 additions & 5 deletions

File tree

‎drivers/platform/x86/wmi.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -771,7 +771,7 @@ static int wmi_dev_match(struct device *dev, struct device_driver *driver)
771771
if (id == NULL)
772772
return 0;
773773

774-
while (id->guid_string) {
774+
while (*id->guid_string) {
775775
uuid_le driver_guid;
776776

777777
if (WARN_ON(uuid_le_to_bin(id->guid_string, &driver_guid)))

‎include/linux/mod_devicetable.h‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -779,4 +779,16 @@ struct typec_device_id {
779779
kernel_ulong_t driver_data;
780780
};
781781

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+
782794
#endif /* LINUX_MOD_DEVICETABLE_H */

‎include/linux/wmi.h‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
#include <linux/device.h>
2020
#include <linux/acpi.h>
21+
#include <linux/mod_devicetable.h>
2122
#include <uapi/linux/wmi.h>
2223

2324
struct wmi_device {
@@ -39,10 +40,6 @@ extern union acpi_object *wmidev_block_query(struct wmi_device *wdev,
3940

4041
extern int set_required_buffer_size(struct wmi_device *wdev, u64 length);
4142

42-
struct wmi_device_id {
43-
const char *guid_string;
44-
};
45-
4643
struct wmi_driver {
4744
struct device_driver driver;
4845
const struct wmi_device_id *id_table;

‎scripts/mod/file2alias.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ typedef unsigned char __u8;
3737
typedef struct {
3838
__u8 b[16];
3939
} uuid_le;
40+
#define UUID_STRING_LEN 36
4041

4142
/* Big exception to the "don't include kernel headers into userspace, which
4243
* even potentially has different endianness and word sizes, since

0 commit comments

Comments
 (0)