diff options
author | Tomas Winkler <tomas.winkler@intel.com> | 2015-09-10 03:18:01 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-09-20 22:30:10 -0400 |
commit | b26864cad1c9f66f4966726ba7bc81d2b9b8f990 (patch) | |
tree | 544ef475f227b687056807d396677c124217824a | |
parent | 40b7320ee413d0d1cc89c32c2a757fda56d27708 (diff) |
mei: bus: add client protocol version to the device alias
The device alias now looks like mei:S:uuid:N:*
In that way we can bind different drivers to clients with
different protocol versions if required.
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/misc/mei/bus.c | 28 | ||||
-rw-r--r-- | drivers/nfc/microread/mei.c | 2 | ||||
-rw-r--r-- | drivers/nfc/pn544/mei.c | 2 | ||||
-rw-r--r-- | include/linux/mod_devicetable.h | 3 | ||||
-rw-r--r-- | scripts/mod/devicetable-offsets.c | 1 | ||||
-rw-r--r-- | scripts/mod/file2alias.c | 4 |
6 files changed, 30 insertions, 10 deletions
diff --git a/drivers/misc/mei/bus.c b/drivers/misc/mei/bus.c index d92017fa1630..38bc4380ad08 100644 --- a/drivers/misc/mei/bus.c +++ b/drivers/misc/mei/bus.c | |||
@@ -453,17 +453,26 @@ struct mei_cl_device_id *mei_cl_device_find(struct mei_cl_device *cldev, | |||
453 | { | 453 | { |
454 | const struct mei_cl_device_id *id; | 454 | const struct mei_cl_device_id *id; |
455 | const uuid_le *uuid; | 455 | const uuid_le *uuid; |
456 | u8 version; | ||
457 | bool match; | ||
456 | 458 | ||
457 | uuid = mei_me_cl_uuid(cldev->me_cl); | 459 | uuid = mei_me_cl_uuid(cldev->me_cl); |
460 | version = mei_me_cl_ver(cldev->me_cl); | ||
458 | 461 | ||
459 | id = cldrv->id_table; | 462 | id = cldrv->id_table; |
460 | while (uuid_le_cmp(NULL_UUID_LE, id->uuid)) { | 463 | while (uuid_le_cmp(NULL_UUID_LE, id->uuid)) { |
461 | if (!uuid_le_cmp(*uuid, id->uuid)) { | 464 | if (!uuid_le_cmp(*uuid, id->uuid)) { |
465 | match = true; | ||
462 | 466 | ||
463 | if (!cldev->name[0]) | 467 | if (cldev->name[0]) |
464 | return id; | 468 | if (strncmp(cldev->name, id->name, |
469 | sizeof(id->name))) | ||
470 | match = false; | ||
465 | 471 | ||
466 | if (!strncmp(cldev->name, id->name, sizeof(id->name))) | 472 | if (id->version != MEI_CL_VERSION_ANY) |
473 | if (id->version != version) | ||
474 | match = false; | ||
475 | if (match) | ||
467 | return id; | 476 | return id; |
468 | } | 477 | } |
469 | 478 | ||
@@ -647,7 +656,8 @@ static int mei_cl_device_uevent(struct device *dev, struct kobj_uevent_env *env) | |||
647 | if (add_uevent_var(env, "MEI_CL_NAME=%s", cldev->name)) | 656 | if (add_uevent_var(env, "MEI_CL_NAME=%s", cldev->name)) |
648 | return -ENOMEM; | 657 | return -ENOMEM; |
649 | 658 | ||
650 | if (add_uevent_var(env, "MODALIAS=mei:%s:%pUl:", cldev->name, uuid)) | 659 | if (add_uevent_var(env, "MODALIAS=mei:%s:%pUl:%02X:", |
660 | cldev->name, uuid, version)) | ||
651 | return -ENOMEM; | 661 | return -ENOMEM; |
652 | 662 | ||
653 | return 0; | 663 | return 0; |
@@ -737,8 +747,10 @@ static bool mei_cl_dev_setup(struct mei_device *bus, | |||
737 | mei_cl_dev_fixup(cldev); | 747 | mei_cl_dev_fixup(cldev); |
738 | 748 | ||
739 | if (cldev->do_match) | 749 | if (cldev->do_match) |
740 | dev_set_name(&cldev->dev, "mei:%s:%pUl", | 750 | dev_set_name(&cldev->dev, "mei:%s:%pUl:%02X", |
741 | cldev->name, mei_me_cl_uuid(cldev->me_cl)); | 751 | cldev->name, |
752 | mei_me_cl_uuid(cldev->me_cl), | ||
753 | mei_me_cl_ver(cldev->me_cl)); | ||
742 | 754 | ||
743 | return cldev->do_match == 1; | 755 | return cldev->do_match == 1; |
744 | } | 756 | } |
@@ -754,7 +766,9 @@ static int mei_cl_bus_dev_add(struct mei_cl_device *cldev) | |||
754 | { | 766 | { |
755 | int ret; | 767 | int ret; |
756 | 768 | ||
757 | dev_dbg(cldev->bus->dev, "adding %pUL\n", mei_me_cl_uuid(cldev->me_cl)); | 769 | dev_dbg(cldev->bus->dev, "adding %pUL:%02X\n", |
770 | mei_me_cl_uuid(cldev->me_cl), | ||
771 | mei_me_cl_ver(cldev->me_cl)); | ||
758 | ret = device_add(&cldev->dev); | 772 | ret = device_add(&cldev->dev); |
759 | if (!ret) | 773 | if (!ret) |
760 | cldev->is_added = 1; | 774 | cldev->is_added = 1; |
diff --git a/drivers/nfc/microread/mei.c b/drivers/nfc/microread/mei.c index f9f5fc97cdd7..93328bd45110 100644 --- a/drivers/nfc/microread/mei.c +++ b/drivers/nfc/microread/mei.c | |||
@@ -67,7 +67,7 @@ static int microread_mei_remove(struct mei_cl_device *device) | |||
67 | } | 67 | } |
68 | 68 | ||
69 | static struct mei_cl_device_id microread_mei_tbl[] = { | 69 | static struct mei_cl_device_id microread_mei_tbl[] = { |
70 | { MICROREAD_DRIVER_NAME, MEI_NFC_UUID}, | 70 | { MICROREAD_DRIVER_NAME, MEI_NFC_UUID, MEI_CL_VERSION_ANY}, |
71 | 71 | ||
72 | /* required last entry */ | 72 | /* required last entry */ |
73 | { } | 73 | { } |
diff --git a/drivers/nfc/pn544/mei.c b/drivers/nfc/pn544/mei.c index 101a37e12efa..80f897b4a401 100644 --- a/drivers/nfc/pn544/mei.c +++ b/drivers/nfc/pn544/mei.c | |||
@@ -67,7 +67,7 @@ static int pn544_mei_remove(struct mei_cl_device *device) | |||
67 | } | 67 | } |
68 | 68 | ||
69 | static struct mei_cl_device_id pn544_mei_tbl[] = { | 69 | static struct mei_cl_device_id pn544_mei_tbl[] = { |
70 | { PN544_DRIVER_NAME, MEI_NFC_UUID}, | 70 | { PN544_DRIVER_NAME, MEI_NFC_UUID, MEI_CL_VERSION_ANY}, |
71 | 71 | ||
72 | /* required last entry */ | 72 | /* required last entry */ |
73 | { } | 73 | { } |
diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h index 5e8a0ad22cbc..6975cbf1435b 100644 --- a/include/linux/mod_devicetable.h +++ b/include/linux/mod_devicetable.h | |||
@@ -601,11 +601,13 @@ struct ipack_device_id { | |||
601 | 601 | ||
602 | #define MEI_CL_MODULE_PREFIX "mei:" | 602 | #define MEI_CL_MODULE_PREFIX "mei:" |
603 | #define MEI_CL_NAME_SIZE 32 | 603 | #define MEI_CL_NAME_SIZE 32 |
604 | #define MEI_CL_VERSION_ANY 0xff | ||
604 | 605 | ||
605 | /** | 606 | /** |
606 | * struct mei_cl_device_id - MEI client device identifier | 607 | * struct mei_cl_device_id - MEI client device identifier |
607 | * @name: helper name | 608 | * @name: helper name |
608 | * @uuid: client uuid | 609 | * @uuid: client uuid |
610 | * @version: client protocol version | ||
609 | * @driver_info: information used by the driver. | 611 | * @driver_info: information used by the driver. |
610 | * | 612 | * |
611 | * identifies mei client device by uuid and name | 613 | * identifies mei client device by uuid and name |
@@ -613,6 +615,7 @@ struct ipack_device_id { | |||
613 | struct mei_cl_device_id { | 615 | struct mei_cl_device_id { |
614 | char name[MEI_CL_NAME_SIZE]; | 616 | char name[MEI_CL_NAME_SIZE]; |
615 | uuid_le uuid; | 617 | uuid_le uuid; |
618 | __u8 version; | ||
616 | kernel_ulong_t driver_info; | 619 | kernel_ulong_t driver_info; |
617 | }; | 620 | }; |
618 | 621 | ||
diff --git a/scripts/mod/devicetable-offsets.c b/scripts/mod/devicetable-offsets.c index e70fcd12eeeb..5a6edacc85d9 100644 --- a/scripts/mod/devicetable-offsets.c +++ b/scripts/mod/devicetable-offsets.c | |||
@@ -185,6 +185,7 @@ int main(void) | |||
185 | DEVID(mei_cl_device_id); | 185 | DEVID(mei_cl_device_id); |
186 | DEVID_FIELD(mei_cl_device_id, name); | 186 | DEVID_FIELD(mei_cl_device_id, name); |
187 | DEVID_FIELD(mei_cl_device_id, uuid); | 187 | DEVID_FIELD(mei_cl_device_id, uuid); |
188 | DEVID_FIELD(mei_cl_device_id, version); | ||
188 | 189 | ||
189 | DEVID(rio_device_id); | 190 | DEVID(rio_device_id); |
190 | DEVID_FIELD(rio_device_id, did); | 191 | DEVID_FIELD(rio_device_id, did); |
diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c index fa79d113f34c..9bc2cfe0ee37 100644 --- a/scripts/mod/file2alias.c +++ b/scripts/mod/file2alias.c | |||
@@ -1202,16 +1202,18 @@ static int do_cpu_entry(const char *filename, void *symval, char *alias) | |||
1202 | } | 1202 | } |
1203 | ADD_TO_DEVTABLE("cpu", cpu_feature, do_cpu_entry); | 1203 | ADD_TO_DEVTABLE("cpu", cpu_feature, do_cpu_entry); |
1204 | 1204 | ||
1205 | /* Looks like: mei:S:uuid */ | 1205 | /* Looks like: mei:S:uuid:N:* */ |
1206 | static int do_mei_entry(const char *filename, void *symval, | 1206 | static int do_mei_entry(const char *filename, void *symval, |
1207 | char *alias) | 1207 | char *alias) |
1208 | { | 1208 | { |
1209 | DEF_FIELD_ADDR(symval, mei_cl_device_id, name); | 1209 | DEF_FIELD_ADDR(symval, mei_cl_device_id, name); |
1210 | DEF_FIELD_ADDR(symval, mei_cl_device_id, uuid); | 1210 | DEF_FIELD_ADDR(symval, mei_cl_device_id, uuid); |
1211 | DEF_FIELD(symval, mei_cl_device_id, version); | ||
1211 | 1212 | ||
1212 | sprintf(alias, MEI_CL_MODULE_PREFIX); | 1213 | sprintf(alias, MEI_CL_MODULE_PREFIX); |
1213 | sprintf(alias + strlen(alias), "%s:", (*name)[0] ? *name : "*"); | 1214 | sprintf(alias + strlen(alias), "%s:", (*name)[0] ? *name : "*"); |
1214 | add_uuid(alias, *uuid); | 1215 | add_uuid(alias, *uuid); |
1216 | ADD(alias, ":", version != MEI_CL_VERSION_ANY, version); | ||
1215 | 1217 | ||
1216 | strcat(alias, ":*"); | 1218 | strcat(alias, ":*"); |
1217 | 1219 | ||