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 | 76 | #define LOADER_XFER_MODE_ISHTP BIT(1) |
| 77 | 77 | |
| 78 | 78 | /* ISH Transport Loader client unique GUID */ |
| 79 | −static const guid_t loader_ishtp_guid = | |
| 80 | − GUID_INIT(0xc804d06a, 0x55bd, 0x4ea7, | |
| 81 | − 0xad, 0xed, 0x1e, 0x31, 0x22, 0x8c, 0x76, 0xdc); | |
| 79 | +static const struct ishtp_device_id loader_ishtp_id_table[] = { | |
| 80 | + { .guid = GUID_INIT(0xc804d06a, 0x55bd, 0x4ea7, | |
| 81 | + 0xad, 0xed, 0x1e, 0x31, 0x22, 0x8c, 0x76, 0xdc) }, | |
| 82 | + { } | |
| 83 | +}; | |
| 84 | +MODULE_DEVICE_TABLE(ishtp, loader_ishtp_id_table); | |
| 82 | 85 | |
| 83 | 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 | 884 | fw_client = |
| 882 | 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 | 887 | if (!fw_client) { |
| 885 | 888 | dev_err(cl_data_to_dev(client_data), |
| 886 | 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 | 1061 | static struct ishtp_cl_driver loader_ishtp_cl_driver = { |
| 1059 | 1062 | .name = "ish-loader", |
| 1060 | − .guid = &loader_ishtp_guid, | |
| 1063 | + .id = loader_ishtp_id_table, | |
| 1061 | 1064 | .probe = loader_ishtp_cl_probe, |
| 1062 | 1065 | .remove = loader_ishtp_cl_remove, |
| 1063 | 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 | 1069 | static int __init ish_loader_init(void) |
| 1073 | 1070 | { |
| 1074 | 1071 | return ishtp_cl_driver_register(&loader_ishtp_cl_driver, THIS_MODULE); |
| @@ -12,9 +12,12 @@ · 11 unmodified lines | ||
| 12 | 12 | #include "ishtp-hid.h" |
| 13 | 13 | |
| 14 | 14 | /* ISH Transport protocol (ISHTP in short) GUID */ |
| 15 | −static const guid_t hid_ishtp_guid = | |
| 16 | − GUID_INIT(0x33AECD58, 0xB679, 0x4E54, | |
| 17 | − 0x9B, 0xD9, 0xA0, 0x4D, 0x34, 0xF0, 0xC2, 0x26); | |
| 15 | +static const struct ishtp_device_id hid_ishtp_id_table[] = { | |
| 16 | + { .guid = GUID_INIT(0x33AECD58, 0xB679, 0x4E54, | |
| 17 | + 0x9B, 0xD9, 0xA0, 0x4D, 0x34, 0xF0, 0xC2, 0x26), }, | |
| 18 | + { } | |
| 19 | +}; | |
| 20 | +MODULE_DEVICE_TABLE(ishtp, hid_ishtp_id_table); | |
| 18 | 21 | |
| 19 | 22 | /* Rx ring buffer pool size */ |
| 20 | 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 | 665 | ishtp_set_tx_ring_size(hid_ishtp_cl, HID_CL_TX_RING_SIZE); |
| 663 | 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 | 669 | if (!fw_client) { |
| 667 | 670 | dev_err(cl_data_to_dev(client_data), |
| 668 | 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 | 949 | static struct ishtp_cl_driver hid_ishtp_cl_driver = { |
| 947 | 950 | .name = "ish-hid", |
| 948 | − .guid = &hid_ishtp_guid, | |
| 951 | + .id = hid_ishtp_id_table, | |
| 949 | 952 | .probe = hid_ishtp_cl_probe, |
| 950 | 953 | .remove = hid_ishtp_cl_remove, |
| 951 | 954 | .reset = hid_ishtp_cl_reset, |
| 952 | 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 | 958 | static int __init ish_hid_init(void) |
| 962 | 959 | { |
| 963 | 960 | int rv; |
| @@ -241,7 +241,7 @@ static int ishtp_cl_bus_match(struct device *dev, struct device_driver *drv) · 240 unmodified lines | ||
| 241 | 241 | struct ishtp_cl_device *device = to_ishtp_cl_device(dev); |
| 242 | 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 | 245 | &device->fw_client->props.protocol_name); |
| 246 | 246 | } |
| 247 | 247 | |
| @@ -41,9 +41,12 @@ enum cros_ec_ish_channel { · 40 unmodified lines | ||
| 41 | 41 | #define ISHTP_SEND_TIMEOUT (3 * HZ) |
| 42 | 42 | |
| 43 | 43 | /* ISH Transport CrOS EC ISH client unique GUID */ |
| 44 | −static const guid_t cros_ish_guid = | |
| 45 | − GUID_INIT(0x7b7154d0, 0x56f4, 0x4bdc, | |
| 46 | − 0xb0, 0xd8, 0x9e, 0x7c, 0xda, 0xe0, 0xd6, 0xa0); | |
| 44 | +static const struct ishtp_device_id cros_ec_ishtp_id_table[] = { | |
| 45 | + { .guid = GUID_INIT(0x7b7154d0, 0x56f4, 0x4bdc, | |
| 46 | + 0xb0, 0xd8, 0x9e, 0x7c, 0xda, 0xe0, 0xd6, 0xa0), }, | |
| 47 | + { } | |
| 48 | +}; | |
| 49 | +MODULE_DEVICE_TABLE(ishtp, cros_ec_ishtp_id_table); | |
| 47 | 50 | |
| 48 | 51 | struct header { |
| 49 | 52 | u8 channel; |
| @@ -389,7 +392,7 @@ static int cros_ish_init(struct ishtp_cl *cros_ish_cl) · 339 unmodified lines | ||
| 389 | 392 | ishtp_set_tx_ring_size(cros_ish_cl, CROS_ISH_CL_TX_RING_SIZE); |
| 390 | 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 | 396 | if (!fw_client) { |
| 394 | 397 | dev_err(cl_data_to_dev(client_data), |
| 395 | 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 | 769 | static struct ishtp_cl_driver cros_ec_ishtp_driver = { |
| 767 | 770 | .name = "cros_ec_ishtp", |
| 768 | − .guid = &cros_ish_guid, | |
| 771 | + .id = cros_ec_ishtp_id_table, | |
| 769 | 772 | .probe = cros_ec_ishtp_probe, |
| 770 | 773 | .remove = cros_ec_ishtp_remove, |
| 771 | 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 | 780 | static int __init cros_ec_ishtp_mod_init(void) |
| 784 | 781 | { |
| 785 | 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 | 95 | /* eclite ishtp client UUID: 6a19cc4b-d760-4de3-b14d-f25ebd0fbcd9 */ |
| 96 | −static const guid_t ecl_ishtp_guid = | |
| 97 | − GUID_INIT(0x6a19cc4b, 0xd760, 0x4de3, | |
| 98 | − 0xb1, 0x4d, 0xf2, 0x5e, 0xbd, 0xf, 0xbc, 0xd9); | |
| 96 | +static const struct ishtp_device_id ecl_ishtp_id_table[] = { | |
| 97 | + { .guid = GUID_INIT(0x6a19cc4b, 0xd760, 0x4de3, | |
| 98 | + 0xb1, 0x4d, 0xf2, 0x5e, 0xbd, 0xf, 0xbc, 0xd9), }, | |
| 99 | + { } | |
| 100 | +}; | |
| 101 | +MODULE_DEVICE_TABLE(ishtp, ecl_ishtp_id_table); | |
| 99 | 102 | |
| 100 | 103 | /* ACPI DSM UUID: 91d936a7-1f01-49c6-a6b4-72f00ad8d8a5 */ |
| 101 | 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 | 465 | ishtp_set_tx_ring_size(ecl_ishtp_cl, ECL_CL_TX_RING_SIZE); |
| 463 | 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 | 469 | if (!fw_client) { |
| 467 | 470 | dev_err(cl_data_to_dev(opr_dev), "fw client not found\n"); |
| 468 | 471 | return -ENOENT; |
| @@ -674,19 +677,13 @@ static const struct dev_pm_ops ecl_ishtp_pm_ops = { · 205 unmodified lines | ||
| 674 | 677 | |
| 675 | 678 | static struct ishtp_cl_driver ecl_ishtp_cl_driver = { |
| 676 | 679 | .name = "ishtp-eclite", |
| 677 | − .guid = &ecl_ishtp_guid, | |
| 680 | + .id = ecl_ishtp_id_table, | |
| 678 | 681 | .probe = ecl_ishtp_cl_probe, |
| 679 | 682 | .remove = ecl_ishtp_cl_remove, |
| 680 | 683 | .reset = ecl_ishtp_cl_reset, |
| 681 | 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 | 687 | static int __init ecl_ishtp_init(void) |
| 691 | 688 | { |
| 692 | 689 | return ishtp_cl_driver_register(&ecl_ishtp_cl_driver, THIS_MODULE); |
| @@ -9,7 +9,7 @@ · 8 unmodified lines | ||
| 9 | 9 | #define _INTEL_ISH_CLIENT_IF_H_ |
| 10 | 10 | |
| 11 | 11 | #include <linux/device.h> |
| 12 | −#include <linux/uuid.h> | |
| 12 | +#include <linux/mod_devicetable.h> | |
| 13 | 13 | |
| 14 | 14 | struct ishtp_cl_device; |
| 15 | 15 | struct ishtp_device; |
| @@ -40,7 +40,7 @@ enum cl_state { · 24 unmodified lines | ||
| 40 | 40 | struct ishtp_cl_driver { |
| 41 | 41 | struct device_driver driver; |
| 42 | 42 | const char *name; |
| 43 | − const guid_t *guid; | |
| 43 | + const struct ishtp_device_id *id; | |
| 44 | 44 | int (*probe)(struct ishtp_cl_device *dev); |
| 45 | 45 | void (*remove)(struct ishtp_cl_device *dev); |
| 46 | 46 | int (*reset)(struct ishtp_cl_device *dev); |
| @@ -902,9 +902,11 @@ struct dfl_device_id { · 901 unmodified lines | ||
| 902 | 902 | /** |
| 903 | 903 | * struct ishtp_device_id - ISHTP device identifier |
| 904 | 904 | * @guid: GUID of the device. |
| 905 | + * @driver_data: pointer to driver specific data | |
| 905 | 906 | */ |
| 906 | 907 | struct ishtp_device_id { |
| 907 | 908 | guid_t guid; |
| 909 | + kernel_ulong_t driver_data; | |
| 908 | 910 | }; |
| 909 | 911 | |
| 910 | 912 | #endif /* LINUX_MOD_DEVICETABLE_H */ |