A late addititon to the intel-ish-hid framework caused a build failure with clang, and introduced an ABI to the module loader that stops working if any driver ever needs to bind to more than one UUID: drivers/hid/intel-ish-hid/ishtp-fw-loader.c:1067:4: error: initializer element is not a compile-time constant Change the ishtp_device_id to have correct documentation and a driver_data field like all the other ones, and change the drivers to use the ID table as the primary identification in a way that works with all compilers and avoids duplciating the identifiers.
Unified · Split
| @@ -76,9 +76,12 @@ enum ish_loader_commands { · 75 unmodified lines | |||
| 76 | #define LOADER_XFER_MODE_ISHTP BIT(1) | 76 | #define LOADER_XFER_MODE_ISHTP BIT(1) |
| 77 | 77 | ||
| 78 | /* ISH Transport Loader client unique GUID */ | 78 | /* ISH Transport Loader client unique GUID */ |
| 79 | static const guid_t loader_ishtp_guid = | 79 | static const struct ishtp_device_id loader_ishtp_id_table[] = { |
| 80 | GUID_INIT(0xc804d06a, 0x55bd, 0x4ea7, | 80 | { .guid = GUID_INIT(0xc804d06a, 0x55bd, 0x4ea7, |
| 81 | 0xad, 0xed, 0x1e, 0x31, 0x22, 0x8c, 0x76, 0xdc); | 81 | 0xad, 0xed, 0x1e, 0x31, 0x22, 0x8c, 0x76, 0xdc) }, |
| 82 | { } | ||
| 83 | }; | ||
| 84 | MODULE_DEVICE_TABLE(ishtp, loader_ishtp_id_table); | ||
| 82 | 85 | ||
| 83 | #define FILENAME_SIZE 256 | 86 | #define FILENAME_SIZE 256 |
| 84 | 87 | ||
| @@ -880,7 +883,7 @@ static int loader_init(struct ishtp_cl *loader_ishtp_cl, int reset) · 795 unmodified lines | |||
| 880 | 883 | ||
| 881 | fw_client = | 884 | fw_client = |
| 882 | ishtp_fw_cl_get_client(ishtp_get_ishtp_device(loader_ishtp_cl), | 885 | ishtp_fw_cl_get_client(ishtp_get_ishtp_device(loader_ishtp_cl), |
| 883 | &loader_ishtp_guid); | 886 | &loader_ishtp_id_table[0].guid); |
| 884 | if (!fw_client) { | 887 | if (!fw_client) { |
| 885 | dev_err(cl_data_to_dev(client_data), | 888 | dev_err(cl_data_to_dev(client_data), |
| 886 | "ISH client uuid not found\n"); | 889 | "ISH client uuid not found\n"); |
| @@ -1057,18 +1060,12 @@ static int loader_ishtp_cl_reset(struct ishtp_cl_device *cl_device) · 170 unmodified lines | |||
| 1057 | 1060 | ||
| 1058 | static struct ishtp_cl_driver loader_ishtp_cl_driver = { | 1061 | static struct ishtp_cl_driver loader_ishtp_cl_driver = { |
| 1059 | .name = "ish-loader", | 1062 | .name = "ish-loader", |
| 1060 | .guid = &loader_ishtp_guid, | 1063 | .id = loader_ishtp_id_table, |
| 1061 | .probe = loader_ishtp_cl_probe, | 1064 | .probe = loader_ishtp_cl_probe, |
| 1062 | .remove = loader_ishtp_cl_remove, | 1065 | .remove = loader_ishtp_cl_remove, |
| 1063 | .reset = loader_ishtp_cl_reset, | 1066 | .reset = loader_ishtp_cl_reset, |
| 1064 | }; | 1067 | }; |
| 1065 | 1068 | ||
| 1066 | static const struct ishtp_device_id loader_ishtp_id_table[] = { | ||
| 1067 | { loader_ishtp_guid }, | ||
| 1068 | { } | ||
| 1069 | }; | ||
| 1070 | MODULE_DEVICE_TABLE(ishtp, loader_ishtp_id_table); | ||
| 1071 | |||
| 1072 | static int __init ish_loader_init(void) | 1069 | static int __init ish_loader_init(void) |
| 1073 | { | 1070 | { |
| 1074 | return ishtp_cl_driver_register(&loader_ishtp_cl_driver, THIS_MODULE); | 1071 | return ishtp_cl_driver_register(&loader_ishtp_cl_driver, THIS_MODULE); |
| @@ -12,9 +12,12 @@ · 11 unmodified lines | |||
| 12 | #include "ishtp-hid.h" | 12 | #include "ishtp-hid.h" |
| 13 | 13 | ||
| 14 | /* ISH Transport protocol (ISHTP in short) GUID */ | 14 | /* ISH Transport protocol (ISHTP in short) GUID */ |
| 15 | static const guid_t hid_ishtp_guid = | 15 | static const struct ishtp_device_id hid_ishtp_id_table[] = { |
| 16 | GUID_INIT(0x33AECD58, 0xB679, 0x4E54, | 16 | { .guid = GUID_INIT(0x33AECD58, 0xB679, 0x4E54, |
| 17 | 0x9B, 0xD9, 0xA0, 0x4D, 0x34, 0xF0, 0xC2, 0x26); | 17 | 0x9B, 0xD9, 0xA0, 0x4D, 0x34, 0xF0, 0xC2, 0x26), }, |
| 18 | { } | ||
| 19 | }; | ||
| 20 | MODULE_DEVICE_TABLE(ishtp, hid_ishtp_id_table); | ||
| 18 | 21 | ||
| 19 | /* Rx ring buffer pool size */ | 22 | /* Rx ring buffer pool size */ |
| 20 | #define HID_CL_RX_RING_SIZE 32 | 23 | #define HID_CL_RX_RING_SIZE 32 |
| @@ -662,7 +665,7 @@ static int hid_ishtp_cl_init(struct ishtp_cl *hid_ishtp_cl, int reset) · 641 unmodified lines | |||
| 662 | ishtp_set_tx_ring_size(hid_ishtp_cl, HID_CL_TX_RING_SIZE); | 665 | ishtp_set_tx_ring_size(hid_ishtp_cl, HID_CL_TX_RING_SIZE); |
| 663 | ishtp_set_rx_ring_size(hid_ishtp_cl, HID_CL_RX_RING_SIZE); | 666 | ishtp_set_rx_ring_size(hid_ishtp_cl, HID_CL_RX_RING_SIZE); |
| 664 | 667 | ||
| 665 | fw_client = ishtp_fw_cl_get_client(dev, &hid_ishtp_guid); | 668 | fw_client = ishtp_fw_cl_get_client(dev, &hid_ishtp_id_table[0].guid); |
| 666 | if (!fw_client) { | 669 | if (!fw_client) { |
| 667 | dev_err(cl_data_to_dev(client_data), | 670 | dev_err(cl_data_to_dev(client_data), |
| 668 | "ish client uuid not found\n"); | 671 | "ish client uuid not found\n"); |
| @@ -945,19 +948,13 @@ static const struct dev_pm_ops hid_ishtp_pm_ops = { · 276 unmodified lines | |||
| 945 | 948 | ||
| 946 | static struct ishtp_cl_driver hid_ishtp_cl_driver = { | 949 | static struct ishtp_cl_driver hid_ishtp_cl_driver = { |
| 947 | .name = "ish-hid", | 950 | .name = "ish-hid", |
| 948 | .guid = &hid_ishtp_guid, | 951 | .id = hid_ishtp_id_table, |
| 949 | .probe = hid_ishtp_cl_probe, | 952 | .probe = hid_ishtp_cl_probe, |
| 950 | .remove = hid_ishtp_cl_remove, | 953 | .remove = hid_ishtp_cl_remove, |
| 951 | .reset = hid_ishtp_cl_reset, | 954 | .reset = hid_ishtp_cl_reset, |
| 952 | .driver.pm = &hid_ishtp_pm_ops, | 955 | .driver.pm = &hid_ishtp_pm_ops, |
| 953 | }; | 956 | }; |
| 954 | 957 | ||
| 955 | static const struct ishtp_device_id hid_ishtp_id_table[] = { | ||
| 956 | { hid_ishtp_guid }, | ||
| 957 | { } | ||
| 958 | }; | ||
| 959 | MODULE_DEVICE_TABLE(ishtp, hid_ishtp_id_table); | ||
| 960 | |||
| 961 | static int __init ish_hid_init(void) | 958 | static int __init ish_hid_init(void) |
| 962 | { | 959 | { |
| 963 | int rv; | 960 | int rv; |
| @@ -241,7 +241,7 @@ static int ishtp_cl_bus_match(struct device *dev, struct device_driver *drv) · 240 unmodified lines | |||
| 241 | struct ishtp_cl_device *device = to_ishtp_cl_device(dev); | 241 | struct ishtp_cl_device *device = to_ishtp_cl_device(dev); |
| 242 | struct ishtp_cl_driver *driver = to_ishtp_cl_driver(drv); | 242 | struct ishtp_cl_driver *driver = to_ishtp_cl_driver(drv); |
| 243 | 243 | ||
| 244 | return guid_equal(driver->guid, | 244 | return guid_equal(&driver->id[0].guid, |
| 245 | &device->fw_client->props.protocol_name); | 245 | &device->fw_client->props.protocol_name); |
| 246 | } | 246 | } |
| 247 | 247 | ||
| @@ -41,9 +41,12 @@ enum cros_ec_ish_channel { · 40 unmodified lines | |||
| 41 | #define ISHTP_SEND_TIMEOUT (3 * HZ) | 41 | #define ISHTP_SEND_TIMEOUT (3 * HZ) |
| 42 | 42 | ||
| 43 | /* ISH Transport CrOS EC ISH client unique GUID */ | 43 | /* ISH Transport CrOS EC ISH client unique GUID */ |
| 44 | static const guid_t cros_ish_guid = | 44 | static const struct ishtp_device_id cros_ec_ishtp_id_table[] = { |
| 45 | GUID_INIT(0x7b7154d0, 0x56f4, 0x4bdc, | 45 | { .guid = GUID_INIT(0x7b7154d0, 0x56f4, 0x4bdc, |
| 46 | 0xb0, 0xd8, 0x9e, 0x7c, 0xda, 0xe0, 0xd6, 0xa0); | 46 | 0xb0, 0xd8, 0x9e, 0x7c, 0xda, 0xe0, 0xd6, 0xa0), }, |
| 47 | { } | ||
| 48 | }; | ||
| 49 | MODULE_DEVICE_TABLE(ishtp, cros_ec_ishtp_id_table); | ||
| 47 | 50 | ||
| 48 | struct header { | 51 | struct header { |
| 49 | u8 channel; | 52 | u8 channel; |
| @@ -389,7 +392,7 @@ static int cros_ish_init(struct ishtp_cl *cros_ish_cl) · 339 unmodified lines | |||
| 389 | ishtp_set_tx_ring_size(cros_ish_cl, CROS_ISH_CL_TX_RING_SIZE); | 392 | ishtp_set_tx_ring_size(cros_ish_cl, CROS_ISH_CL_TX_RING_SIZE); |
| 390 | ishtp_set_rx_ring_size(cros_ish_cl, CROS_ISH_CL_RX_RING_SIZE); | 393 | ishtp_set_rx_ring_size(cros_ish_cl, CROS_ISH_CL_RX_RING_SIZE); |
| 391 | 394 | ||
| 392 | fw_client = ishtp_fw_cl_get_client(dev, &cros_ish_guid); | 395 | fw_client = ishtp_fw_cl_get_client(dev, &cros_ec_ishtp_id_table[0].guid); |
| 393 | if (!fw_client) { | 396 | if (!fw_client) { |
| 394 | dev_err(cl_data_to_dev(client_data), | 397 | dev_err(cl_data_to_dev(client_data), |
| 395 | "ish client uuid not found\n"); | 398 | "ish client uuid not found\n"); |
| @@ -765,7 +768,7 @@ static SIMPLE_DEV_PM_OPS(cros_ec_ishtp_pm_ops, cros_ec_ishtp_suspend, · 369 unmodified lines | |||
| 765 | 768 | ||
| 766 | static struct ishtp_cl_driver cros_ec_ishtp_driver = { | 769 | static struct ishtp_cl_driver cros_ec_ishtp_driver = { |
| 767 | .name = "cros_ec_ishtp", | 770 | .name = "cros_ec_ishtp", |
| 768 | .guid = &cros_ish_guid, | 771 | .id = cros_ec_ishtp_id_table, |
| 769 | .probe = cros_ec_ishtp_probe, | 772 | .probe = cros_ec_ishtp_probe, |
| 770 | .remove = cros_ec_ishtp_remove, | 773 | .remove = cros_ec_ishtp_remove, |
| 771 | .reset = cros_ec_ishtp_reset, | 774 | .reset = cros_ec_ishtp_reset, |
| @@ -774,12 +777,6 @@ static struct ishtp_cl_driver cros_ec_ishtp_driver = { · 2 unmodified lines | |||
| 774 | }, | 777 | }, |
| 775 | }; | 778 | }; |
| 776 | 779 | ||
| 777 | static const struct ishtp_device_id cros_ec_ishtp_id_table[] = { | ||
| 778 | { cros_ish_guid }, | ||
| 779 | { } | ||
| 780 | }; | ||
| 781 | MODULE_DEVICE_TABLE(ishtp, cros_ec_ishtp_id_table); | ||
| 782 | |||
| 783 | static int __init cros_ec_ishtp_mod_init(void) | 780 | static int __init cros_ec_ishtp_mod_init(void) |
| 784 | { | 781 | { |
| 785 | return ishtp_cl_driver_register(&cros_ec_ishtp_driver, THIS_MODULE); | 782 | return ishtp_cl_driver_register(&cros_ec_ishtp_driver, THIS_MODULE); |
| @@ -93,9 +93,12 @@ struct ishtp_opregion_dev { · 92 unmodified lines | |||
| 93 | }; | 93 | }; |
| 94 | 94 | ||
| 95 | /* eclite ishtp client UUID: 6a19cc4b-d760-4de3-b14d-f25ebd0fbcd9 */ | 95 | /* eclite ishtp client UUID: 6a19cc4b-d760-4de3-b14d-f25ebd0fbcd9 */ |
| 96 | static const guid_t ecl_ishtp_guid = | 96 | static const struct ishtp_device_id ecl_ishtp_id_table[] = { |
| 97 | GUID_INIT(0x6a19cc4b, 0xd760, 0x4de3, | 97 | { .guid = GUID_INIT(0x6a19cc4b, 0xd760, 0x4de3, |
| 98 | 0xb1, 0x4d, 0xf2, 0x5e, 0xbd, 0xf, 0xbc, 0xd9); | 98 | 0xb1, 0x4d, 0xf2, 0x5e, 0xbd, 0xf, 0xbc, 0xd9), }, |
| 99 | { } | ||
| 100 | }; | ||
| 101 | MODULE_DEVICE_TABLE(ishtp, ecl_ishtp_id_table); | ||
| 99 | 102 | ||
| 100 | /* ACPI DSM UUID: 91d936a7-1f01-49c6-a6b4-72f00ad8d8a5 */ | 103 | /* ACPI DSM UUID: 91d936a7-1f01-49c6-a6b4-72f00ad8d8a5 */ |
| 101 | static const guid_t ecl_acpi_guid = | 104 | static const guid_t ecl_acpi_guid = |
| @@ -462,7 +465,7 @@ static int ecl_ishtp_cl_init(struct ishtp_cl *ecl_ishtp_cl) · 360 unmodified lines | |||
| 462 | ishtp_set_tx_ring_size(ecl_ishtp_cl, ECL_CL_TX_RING_SIZE); | 465 | ishtp_set_tx_ring_size(ecl_ishtp_cl, ECL_CL_TX_RING_SIZE); |
| 463 | ishtp_set_rx_ring_size(ecl_ishtp_cl, ECL_CL_RX_RING_SIZE); | 466 | ishtp_set_rx_ring_size(ecl_ishtp_cl, ECL_CL_RX_RING_SIZE); |
| 464 | 467 | ||
| 465 | fw_client = ishtp_fw_cl_get_client(dev, &ecl_ishtp_guid); | 468 | fw_client = ishtp_fw_cl_get_client(dev, &ecl_ishtp_id_table[0].guid); |
| 466 | if (!fw_client) { | 469 | if (!fw_client) { |
| 467 | dev_err(cl_data_to_dev(opr_dev), "fw client not found\n"); | 470 | dev_err(cl_data_to_dev(opr_dev), "fw client not found\n"); |
| 468 | return -ENOENT; | 471 | return -ENOENT; |
| @@ -674,19 +677,13 @@ static const struct dev_pm_ops ecl_ishtp_pm_ops = { · 205 unmodified lines | |||
| 674 | 677 | ||
| 675 | static struct ishtp_cl_driver ecl_ishtp_cl_driver = { | 678 | static struct ishtp_cl_driver ecl_ishtp_cl_driver = { |
| 676 | .name = "ishtp-eclite", | 679 | .name = "ishtp-eclite", |
| 677 | .guid = &ecl_ishtp_guid, | 680 | .id = ecl_ishtp_id_table, |
| 678 | .probe = ecl_ishtp_cl_probe, | 681 | .probe = ecl_ishtp_cl_probe, |
| 679 | .remove = ecl_ishtp_cl_remove, | 682 | .remove = ecl_ishtp_cl_remove, |
| 680 | .reset = ecl_ishtp_cl_reset, | 683 | .reset = ecl_ishtp_cl_reset, |
| 681 | .driver.pm = &ecl_ishtp_pm_ops, | 684 | .driver.pm = &ecl_ishtp_pm_ops, |
| 682 | }; | 685 | }; |
| 683 | 686 | ||
| 684 | static const struct ishtp_device_id ecl_ishtp_id_table[] = { | ||
| 685 | { ecl_ishtp_guid }, | ||
| 686 | { } | ||
| 687 | }; | ||
| 688 | MODULE_DEVICE_TABLE(ishtp, ecl_ishtp_id_table); | ||
| 689 | |||
| 690 | static int __init ecl_ishtp_init(void) | 687 | static int __init ecl_ishtp_init(void) |
| 691 | { | 688 | { |
| 692 | return ishtp_cl_driver_register(&ecl_ishtp_cl_driver, THIS_MODULE); | 689 | return ishtp_cl_driver_register(&ecl_ishtp_cl_driver, THIS_MODULE); |
| @@ -9,7 +9,7 @@ · 8 unmodified lines | |||
| 9 | #define _INTEL_ISH_CLIENT_IF_H_ | 9 | #define _INTEL_ISH_CLIENT_IF_H_ |
| 10 | 10 | ||
| 11 | #include <linux/device.h> | 11 | #include <linux/device.h> |
| 12 | #include <linux/uuid.h> | 12 | #include <linux/mod_devicetable.h> |
| 13 | 13 | ||
| 14 | struct ishtp_cl_device; | 14 | struct ishtp_cl_device; |
| 15 | struct ishtp_device; | 15 | struct ishtp_device; |
| @@ -40,7 +40,7 @@ enum cl_state { · 24 unmodified lines | |||
| 40 | struct ishtp_cl_driver { | 40 | struct ishtp_cl_driver { |
| 41 | struct device_driver driver; | 41 | struct device_driver driver; |
| 42 | const char *name; | 42 | const char *name; |
| 43 | const guid_t *guid; | 43 | const struct ishtp_device_id *id; |
| 44 | int (*probe)(struct ishtp_cl_device *dev); | 44 | int (*probe)(struct ishtp_cl_device *dev); |
| 45 | void (*remove)(struct ishtp_cl_device *dev); | 45 | void (*remove)(struct ishtp_cl_device *dev); |
| 46 | int (*reset)(struct ishtp_cl_device *dev); | 46 | int (*reset)(struct ishtp_cl_device *dev); |
| @@ -902,9 +902,11 @@ struct dfl_device_id { · 901 unmodified lines | |||
| 902 | /** | 902 | /** |
| 903 | * struct ishtp_device_id - ISHTP device identifier | 903 | * struct ishtp_device_id - ISHTP device identifier |
| 904 | * @guid: GUID of the device. | 904 | * @guid: GUID of the device. |
| 905 | * @driver_data: pointer to driver specific data | ||
| 905 | */ | 906 | */ |
| 906 | struct ishtp_device_id { | 907 | struct ishtp_device_id { |
| 907 | guid_t guid; | 908 | guid_t guid; |
| 909 | kernel_ulong_t driver_data; | ||
| 908 | }; | 910 | }; |
| 909 | 911 | ||
| 910 | #endif /* LINUX_MOD_DEVICETABLE_H */ | 912 | #endif /* LINUX_MOD_DEVICETABLE_H */ |