forked from Minki/linux
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>
This commit is contained in:
parent
40b7320ee4
commit
b26864cad1
@ -453,17 +453,26 @@ struct mei_cl_device_id *mei_cl_device_find(struct mei_cl_device *cldev,
|
||||
{
|
||||
const struct mei_cl_device_id *id;
|
||||
const uuid_le *uuid;
|
||||
u8 version;
|
||||
bool match;
|
||||
|
||||
uuid = mei_me_cl_uuid(cldev->me_cl);
|
||||
version = mei_me_cl_ver(cldev->me_cl);
|
||||
|
||||
id = cldrv->id_table;
|
||||
while (uuid_le_cmp(NULL_UUID_LE, id->uuid)) {
|
||||
if (!uuid_le_cmp(*uuid, id->uuid)) {
|
||||
match = true;
|
||||
|
||||
if (!cldev->name[0])
|
||||
return id;
|
||||
if (cldev->name[0])
|
||||
if (strncmp(cldev->name, id->name,
|
||||
sizeof(id->name)))
|
||||
match = false;
|
||||
|
||||
if (!strncmp(cldev->name, id->name, sizeof(id->name)))
|
||||
if (id->version != MEI_CL_VERSION_ANY)
|
||||
if (id->version != version)
|
||||
match = false;
|
||||
if (match)
|
||||
return id;
|
||||
}
|
||||
|
||||
@ -647,7 +656,8 @@ static int mei_cl_device_uevent(struct device *dev, struct kobj_uevent_env *env)
|
||||
if (add_uevent_var(env, "MEI_CL_NAME=%s", cldev->name))
|
||||
return -ENOMEM;
|
||||
|
||||
if (add_uevent_var(env, "MODALIAS=mei:%s:%pUl:", cldev->name, uuid))
|
||||
if (add_uevent_var(env, "MODALIAS=mei:%s:%pUl:%02X:",
|
||||
cldev->name, uuid, version))
|
||||
return -ENOMEM;
|
||||
|
||||
return 0;
|
||||
@ -737,8 +747,10 @@ static bool mei_cl_dev_setup(struct mei_device *bus,
|
||||
mei_cl_dev_fixup(cldev);
|
||||
|
||||
if (cldev->do_match)
|
||||
dev_set_name(&cldev->dev, "mei:%s:%pUl",
|
||||
cldev->name, mei_me_cl_uuid(cldev->me_cl));
|
||||
dev_set_name(&cldev->dev, "mei:%s:%pUl:%02X",
|
||||
cldev->name,
|
||||
mei_me_cl_uuid(cldev->me_cl),
|
||||
mei_me_cl_ver(cldev->me_cl));
|
||||
|
||||
return cldev->do_match == 1;
|
||||
}
|
||||
@ -754,7 +766,9 @@ static int mei_cl_bus_dev_add(struct mei_cl_device *cldev)
|
||||
{
|
||||
int ret;
|
||||
|
||||
dev_dbg(cldev->bus->dev, "adding %pUL\n", mei_me_cl_uuid(cldev->me_cl));
|
||||
dev_dbg(cldev->bus->dev, "adding %pUL:%02X\n",
|
||||
mei_me_cl_uuid(cldev->me_cl),
|
||||
mei_me_cl_ver(cldev->me_cl));
|
||||
ret = device_add(&cldev->dev);
|
||||
if (!ret)
|
||||
cldev->is_added = 1;
|
||||
|
@ -67,7 +67,7 @@ static int microread_mei_remove(struct mei_cl_device *device)
|
||||
}
|
||||
|
||||
static struct mei_cl_device_id microread_mei_tbl[] = {
|
||||
{ MICROREAD_DRIVER_NAME, MEI_NFC_UUID},
|
||||
{ MICROREAD_DRIVER_NAME, MEI_NFC_UUID, MEI_CL_VERSION_ANY},
|
||||
|
||||
/* required last entry */
|
||||
{ }
|
||||
|
@ -67,7 +67,7 @@ static int pn544_mei_remove(struct mei_cl_device *device)
|
||||
}
|
||||
|
||||
static struct mei_cl_device_id pn544_mei_tbl[] = {
|
||||
{ PN544_DRIVER_NAME, MEI_NFC_UUID},
|
||||
{ PN544_DRIVER_NAME, MEI_NFC_UUID, MEI_CL_VERSION_ANY},
|
||||
|
||||
/* required last entry */
|
||||
{ }
|
||||
|
@ -601,11 +601,13 @@ struct ipack_device_id {
|
||||
|
||||
#define MEI_CL_MODULE_PREFIX "mei:"
|
||||
#define MEI_CL_NAME_SIZE 32
|
||||
#define MEI_CL_VERSION_ANY 0xff
|
||||
|
||||
/**
|
||||
* struct mei_cl_device_id - MEI client device identifier
|
||||
* @name: helper name
|
||||
* @uuid: client uuid
|
||||
* @version: client protocol version
|
||||
* @driver_info: information used by the driver.
|
||||
*
|
||||
* identifies mei client device by uuid and name
|
||||
@ -613,6 +615,7 @@ struct ipack_device_id {
|
||||
struct mei_cl_device_id {
|
||||
char name[MEI_CL_NAME_SIZE];
|
||||
uuid_le uuid;
|
||||
__u8 version;
|
||||
kernel_ulong_t driver_info;
|
||||
};
|
||||
|
||||
|
@ -185,6 +185,7 @@ int main(void)
|
||||
DEVID(mei_cl_device_id);
|
||||
DEVID_FIELD(mei_cl_device_id, name);
|
||||
DEVID_FIELD(mei_cl_device_id, uuid);
|
||||
DEVID_FIELD(mei_cl_device_id, version);
|
||||
|
||||
DEVID(rio_device_id);
|
||||
DEVID_FIELD(rio_device_id, did);
|
||||
|
@ -1202,16 +1202,18 @@ static int do_cpu_entry(const char *filename, void *symval, char *alias)
|
||||
}
|
||||
ADD_TO_DEVTABLE("cpu", cpu_feature, do_cpu_entry);
|
||||
|
||||
/* Looks like: mei:S:uuid */
|
||||
/* Looks like: mei:S:uuid:N:* */
|
||||
static int do_mei_entry(const char *filename, void *symval,
|
||||
char *alias)
|
||||
{
|
||||
DEF_FIELD_ADDR(symval, mei_cl_device_id, name);
|
||||
DEF_FIELD_ADDR(symval, mei_cl_device_id, uuid);
|
||||
DEF_FIELD(symval, mei_cl_device_id, version);
|
||||
|
||||
sprintf(alias, MEI_CL_MODULE_PREFIX);
|
||||
sprintf(alias + strlen(alias), "%s:", (*name)[0] ? *name : "*");
|
||||
add_uuid(alias, *uuid);
|
||||
ADD(alias, ":", version != MEI_CL_VERSION_ANY, version);
|
||||
|
||||
strcat(alias, ":*");
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user