diff options
author | Tomas Winkler <tomas.winkler@intel.com> | 2014-08-21 07:29:14 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-09-24 01:57:48 -0400 |
commit | 25ca6472b590e87efba314892a76bd5629c8c989 (patch) | |
tree | 05682ec6384dda9d3101adf4c8f6051704ae8ed1 /drivers/misc/mei | |
parent | 5ca2d3882d60c040285d0b45df731e11f5da7c64 (diff) |
mei: add me client remove functions
To support dynamic addition/remove we add wrappers
for removal of me clients
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/misc/mei')
-rw-r--r-- | drivers/misc/mei/client.c | 22 | ||||
-rw-r--r-- | drivers/misc/mei/client.h | 2 | ||||
-rw-r--r-- | drivers/misc/mei/hbm.c | 21 |
3 files changed, 38 insertions, 7 deletions
diff --git a/drivers/misc/mei/client.c b/drivers/misc/mei/client.c index 244b54692b48..10d0a04f45d6 100644 --- a/drivers/misc/mei/client.c +++ b/drivers/misc/mei/client.c | |||
@@ -47,7 +47,6 @@ struct mei_me_client *mei_me_cl_by_uuid(const struct mei_device *dev, | |||
47 | return NULL; | 47 | return NULL; |
48 | } | 48 | } |
49 | 49 | ||
50 | |||
51 | /** | 50 | /** |
52 | * mei_me_cl_by_id return index to me_clients for client_id | 51 | * mei_me_cl_by_id return index to me_clients for client_id |
53 | * | 52 | * |
@@ -70,6 +69,27 @@ struct mei_me_client *mei_me_cl_by_id(struct mei_device *dev, u8 client_id) | |||
70 | return NULL; | 69 | return NULL; |
71 | } | 70 | } |
72 | 71 | ||
72 | /** | ||
73 | * mei_me_cl_remove - remove me client matching uuid and client_id | ||
74 | * | ||
75 | * @dev: the device structure | ||
76 | * @uuid: me client uuid | ||
77 | * @client_id: me client address | ||
78 | */ | ||
79 | void mei_me_cl_remove(struct mei_device *dev, const uuid_le *uuid, u8 client_id) | ||
80 | { | ||
81 | struct mei_me_client *me_cl, *next; | ||
82 | |||
83 | list_for_each_entry_safe(me_cl, next, &dev->me_clients, list) { | ||
84 | if (uuid_le_cmp(*uuid, me_cl->props.protocol_name) == 0 && | ||
85 | me_cl->client_id == client_id) { | ||
86 | list_del(&me_cl->list); | ||
87 | kfree(me_cl); | ||
88 | break; | ||
89 | } | ||
90 | } | ||
91 | } | ||
92 | |||
73 | 93 | ||
74 | /** | 94 | /** |
75 | * mei_cl_cmp_id - tells if the clients are the same | 95 | * mei_cl_cmp_id - tells if the clients are the same |
diff --git a/drivers/misc/mei/client.h b/drivers/misc/mei/client.h index ddb95b2ee2ac..8871a852cfbb 100644 --- a/drivers/misc/mei/client.h +++ b/drivers/misc/mei/client.h | |||
@@ -27,6 +27,8 @@ | |||
27 | struct mei_me_client *mei_me_cl_by_uuid(const struct mei_device *dev, | 27 | struct mei_me_client *mei_me_cl_by_uuid(const struct mei_device *dev, |
28 | const uuid_le *cuuid); | 28 | const uuid_le *cuuid); |
29 | struct mei_me_client *mei_me_cl_by_id(struct mei_device *dev, u8 client_id); | 29 | struct mei_me_client *mei_me_cl_by_id(struct mei_device *dev, u8 client_id); |
30 | void mei_me_cl_remove(struct mei_device *dev, | ||
31 | const uuid_le *uuid, u8 client_id); | ||
30 | 32 | ||
31 | /* | 33 | /* |
32 | * MEI IO Functions | 34 | * MEI IO Functions |
diff --git a/drivers/misc/mei/hbm.c b/drivers/misc/mei/hbm.c index 45659de14186..5fb177b3bfef 100644 --- a/drivers/misc/mei/hbm.c +++ b/drivers/misc/mei/hbm.c | |||
@@ -71,21 +71,30 @@ void mei_hbm_idle(struct mei_device *dev) | |||
71 | } | 71 | } |
72 | 72 | ||
73 | /** | 73 | /** |
74 | * mei_hbm_reset - reset hbm counters and book keeping data structurs | 74 | * mei_me_cl_remove_all - remove all me clients |
75 | * | 75 | * |
76 | * @dev: the device structure | 76 | * @dev: the device structure |
77 | */ | 77 | */ |
78 | void mei_hbm_reset(struct mei_device *dev) | 78 | static void mei_me_cl_remove_all(struct mei_device *dev) |
79 | { | 79 | { |
80 | struct mei_me_client *me_cl, *next; | 80 | struct mei_me_client *me_cl, *next; |
81 | list_for_each_entry_safe(me_cl, next, &dev->me_clients, list) { | ||
82 | list_del(&me_cl->list); | ||
83 | kfree(me_cl); | ||
84 | } | ||
85 | } | ||
81 | 86 | ||
87 | /** | ||
88 | * mei_hbm_reset - reset hbm counters and book keeping data structurs | ||
89 | * | ||
90 | * @dev: the device structure | ||
91 | */ | ||
92 | void mei_hbm_reset(struct mei_device *dev) | ||
93 | { | ||
82 | dev->me_client_presentation_num = 0; | 94 | dev->me_client_presentation_num = 0; |
83 | dev->me_client_index = 0; | 95 | dev->me_client_index = 0; |
84 | 96 | ||
85 | list_for_each_entry_safe(me_cl, next, &dev->me_clients, list) { | 97 | mei_me_cl_remove_all(dev); |
86 | list_del(&me_cl->list); | ||
87 | kfree(me_cl); | ||
88 | } | ||
89 | 98 | ||
90 | mei_hbm_idle(dev); | 99 | mei_hbm_idle(dev); |
91 | } | 100 | } |