diff options
Diffstat (limited to 'drivers/misc/mei/client.c')
-rw-r--r-- | drivers/misc/mei/client.c | 34 |
1 files changed, 15 insertions, 19 deletions
diff --git a/drivers/misc/mei/client.c b/drivers/misc/mei/client.c index a20e6e9422f8..244b54692b48 100644 --- a/drivers/misc/mei/client.c +++ b/drivers/misc/mei/client.c | |||
@@ -38,12 +38,11 @@ | |||
38 | struct mei_me_client *mei_me_cl_by_uuid(const struct mei_device *dev, | 38 | struct mei_me_client *mei_me_cl_by_uuid(const struct mei_device *dev, |
39 | const uuid_le *uuid) | 39 | const uuid_le *uuid) |
40 | { | 40 | { |
41 | int i; | 41 | struct mei_me_client *me_cl; |
42 | 42 | ||
43 | for (i = 0; i < dev->me_clients_num; ++i) | 43 | list_for_each_entry(me_cl, &dev->me_clients, list) |
44 | if (uuid_le_cmp(*uuid, | 44 | if (uuid_le_cmp(*uuid, me_cl->props.protocol_name) == 0) |
45 | dev->me_clients[i].props.protocol_name) == 0) | 45 | return me_cl; |
46 | return &dev->me_clients[i]; | ||
47 | 46 | ||
48 | return NULL; | 47 | return NULL; |
49 | } | 48 | } |
@@ -62,12 +61,12 @@ struct mei_me_client *mei_me_cl_by_uuid(const struct mei_device *dev, | |||
62 | 61 | ||
63 | struct mei_me_client *mei_me_cl_by_id(struct mei_device *dev, u8 client_id) | 62 | struct mei_me_client *mei_me_cl_by_id(struct mei_device *dev, u8 client_id) |
64 | { | 63 | { |
65 | int i; | ||
66 | 64 | ||
67 | for (i = 0; i < dev->me_clients_num; i++) | 65 | struct mei_me_client *me_cl; |
68 | if (dev->me_clients[i].client_id == client_id) | ||
69 | return &dev->me_clients[i]; | ||
70 | 66 | ||
67 | list_for_each_entry(me_cl, &dev->me_clients, list) | ||
68 | if (me_cl->client_id == client_id) | ||
69 | return me_cl; | ||
71 | return NULL; | 70 | return NULL; |
72 | } | 71 | } |
73 | 72 | ||
@@ -396,19 +395,19 @@ void mei_host_client_init(struct work_struct *work) | |||
396 | { | 395 | { |
397 | struct mei_device *dev = container_of(work, | 396 | struct mei_device *dev = container_of(work, |
398 | struct mei_device, init_work); | 397 | struct mei_device, init_work); |
399 | struct mei_client_properties *client_props; | 398 | struct mei_me_client *me_cl; |
400 | int i; | 399 | struct mei_client_properties *props; |
401 | 400 | ||
402 | mutex_lock(&dev->device_lock); | 401 | mutex_lock(&dev->device_lock); |
403 | 402 | ||
404 | for (i = 0; i < dev->me_clients_num; i++) { | 403 | list_for_each_entry(me_cl, &dev->me_clients, list) { |
405 | client_props = &dev->me_clients[i].props; | 404 | props = &me_cl->props; |
406 | 405 | ||
407 | if (!uuid_le_cmp(client_props->protocol_name, mei_amthif_guid)) | 406 | if (!uuid_le_cmp(props->protocol_name, mei_amthif_guid)) |
408 | mei_amthif_host_init(dev); | 407 | mei_amthif_host_init(dev); |
409 | else if (!uuid_le_cmp(client_props->protocol_name, mei_wd_guid)) | 408 | else if (!uuid_le_cmp(props->protocol_name, mei_wd_guid)) |
410 | mei_wd_host_init(dev); | 409 | mei_wd_host_init(dev); |
411 | else if (!uuid_le_cmp(client_props->protocol_name, mei_nfc_guid)) | 410 | else if (!uuid_le_cmp(props->protocol_name, mei_nfc_guid)) |
412 | mei_nfc_host_init(dev); | 411 | mei_nfc_host_init(dev); |
413 | 412 | ||
414 | } | 413 | } |
@@ -653,9 +652,6 @@ int mei_cl_flow_ctrl_creds(struct mei_cl *cl) | |||
653 | 652 | ||
654 | dev = cl->dev; | 653 | dev = cl->dev; |
655 | 654 | ||
656 | if (!dev->me_clients_num) | ||
657 | return 0; | ||
658 | |||
659 | if (cl->mei_flow_ctrl_creds > 0) | 655 | if (cl->mei_flow_ctrl_creds > 0) |
660 | return 1; | 656 | return 1; |
661 | 657 | ||