diff options
author | Tomas Winkler <tomas.winkler@intel.com> | 2014-08-21 14:29:15 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-09-23 22:57:48 -0700 |
commit | d880f3294d0576e79dfab4e2cd5a2eb62fe188f0 (patch) | |
tree | a36fc7837df60ae8d004524f42c3fd0924c5ee75 /drivers/misc/mei/client.c | |
parent | 25ca6472b590e87efba314892a76bd5629c8c989 (diff) |
mei: add mei_me_cl_by_uuid_id function
When handling dynamic clients there might be a race
scenario in which two me clients with the same me
address would be linked in the me clients list,
therefore we need to search by both uuid and me address.
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/misc/mei/client.c')
-rw-r--r-- | drivers/misc/mei/client.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/drivers/misc/mei/client.c b/drivers/misc/mei/client.c index 10d0a04f45d6..1a4dafb77205 100644 --- a/drivers/misc/mei/client.c +++ b/drivers/misc/mei/client.c @@ -69,6 +69,18 @@ struct mei_me_client *mei_me_cl_by_id(struct mei_device *dev, u8 client_id) return NULL; } +struct mei_me_client *mei_me_cl_by_uuid_id(struct mei_device *dev, + const uuid_le *uuid, u8 client_id) +{ + struct mei_me_client *me_cl; + + list_for_each_entry(me_cl, &dev->me_clients, list) + if (uuid_le_cmp(*uuid, me_cl->props.protocol_name) == 0 && + me_cl->client_id == client_id) + return me_cl; + return NULL; +} + /** * mei_me_cl_remove - remove me client matching uuid and client_id * @@ -753,7 +765,7 @@ int mei_cl_read_start(struct mei_cl *cl, size_t length) cl_dbg(dev, cl, "read is pending.\n"); return -EBUSY; } - me_cl = mei_me_cl_by_id(dev, cl->me_client_id); + me_cl = mei_me_cl_by_uuid_id(dev, &cl->cl_uuid, cl->me_client_id); if (!me_cl) { cl_err(dev, cl, "no such me client %d\n", cl->me_client_id); return -ENOTTY; |