aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/misc/mei
diff options
context:
space:
mode:
authorTomas Winkler <tomas.winkler@intel.com>2013-01-08 16:07:19 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-01-08 19:40:45 -0500
commita40b260da6d96ab5231ebdabd06e70568ca81885 (patch)
tree5f8e6d5a82f5768a69e959197473ff4a10f5e26d /drivers/misc/mei
parentd91aaed30a938c5daae2641e6758dfab8727862e (diff)
mei: move me client storage allocation to hbm.c
rename function to mei_me_cl_allocate to match the current names convention: mei_hbm_me_cl_allocate 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/hbm.c39
-rw-r--r--drivers/misc/mei/init.c39
-rw-r--r--drivers/misc/mei/mei_dev.h1
3 files changed, 38 insertions, 41 deletions
diff --git a/drivers/misc/mei/hbm.c b/drivers/misc/mei/hbm.c
index f0c3fc4590d5..fb9e63ba3bb1 100644
--- a/drivers/misc/mei/hbm.c
+++ b/drivers/misc/mei/hbm.c
@@ -24,6 +24,43 @@
24#include "hw-me.h" 24#include "hw-me.h"
25 25
26/** 26/**
27 * mei_hbm_me_cl_allocate - allocates storage for me clients
28 *
29 * @dev: the device structure
30 *
31 * returns none.
32 */
33static void mei_hbm_me_cl_allocate(struct mei_device *dev)
34{
35 struct mei_me_client *clients;
36 int b;
37
38 /* count how many ME clients we have */
39 for_each_set_bit(b, dev->me_clients_map, MEI_CLIENTS_MAX)
40 dev->me_clients_num++;
41
42 if (dev->me_clients_num <= 0)
43 return;
44
45 kfree(dev->me_clients);
46 dev->me_clients = NULL;
47
48 dev_dbg(&dev->pdev->dev, "memory allocation for ME clients size=%zd.\n",
49 dev->me_clients_num * sizeof(struct mei_me_client));
50 /* allocate storage for ME clients representation */
51 clients = kcalloc(dev->me_clients_num,
52 sizeof(struct mei_me_client), GFP_KERNEL);
53 if (!clients) {
54 dev_err(&dev->pdev->dev, "memory allocation for ME clients failed.\n");
55 dev->dev_state = MEI_DEV_RESETING;
56 mei_reset(dev, 1);
57 return;
58 }
59 dev->me_clients = clients;
60 return;
61}
62
63/**
27 * mei_hbm_cl_hdr - construct client hbm header 64 * mei_hbm_cl_hdr - construct client hbm header
28 * @cl: - client 65 * @cl: - client
29 * @hbm_cmd: host bus message command 66 * @hbm_cmd: host bus message command
@@ -593,7 +630,7 @@ void mei_hbm_dispatch(struct mei_device *dev, struct mei_msg_hdr *hdr)
593 dev->init_clients_timer = 0; 630 dev->init_clients_timer = 0;
594 dev->me_client_presentation_num = 0; 631 dev->me_client_presentation_num = 0;
595 dev->me_client_index = 0; 632 dev->me_client_index = 0;
596 mei_allocate_me_clients_storage(dev); 633 mei_hbm_me_cl_allocate(dev);
597 dev->init_clients_state = 634 dev->init_clients_state =
598 MEI_CLIENT_PROPERTIES_MESSAGE; 635 MEI_CLIENT_PROPERTIES_MESSAGE;
599 636
diff --git a/drivers/misc/mei/init.c b/drivers/misc/mei/init.c
index 88407dfd8557..636639fbfc0a 100644
--- a/drivers/misc/mei/init.c
+++ b/drivers/misc/mei/init.c
@@ -278,44 +278,5 @@ void mei_reset(struct mei_device *dev, int interrupts_enabled)
278} 278}
279 279
280 280
281/**
282 * allocate_me_clients_storage - allocates storage for me clients
283 *
284 * @dev: the device structure
285 *
286 * returns none.
287 */
288void mei_allocate_me_clients_storage(struct mei_device *dev)
289{
290 struct mei_me_client *clients;
291 int b;
292
293 /* count how many ME clients we have */
294 for_each_set_bit(b, dev->me_clients_map, MEI_CLIENTS_MAX)
295 dev->me_clients_num++;
296
297 if (dev->me_clients_num <= 0)
298 return ;
299
300
301 if (dev->me_clients != NULL) {
302 kfree(dev->me_clients);
303 dev->me_clients = NULL;
304 }
305 dev_dbg(&dev->pdev->dev, "memory allocation for ME clients size=%zd.\n",
306 dev->me_clients_num * sizeof(struct mei_me_client));
307 /* allocate storage for ME clients representation */
308 clients = kcalloc(dev->me_clients_num,
309 sizeof(struct mei_me_client), GFP_KERNEL);
310 if (!clients) {
311 dev_dbg(&dev->pdev->dev, "memory allocation for ME clients failed.\n");
312 dev->dev_state = MEI_DEV_RESETING;
313 mei_reset(dev, 1);
314 return ;
315 }
316 dev->me_clients = clients;
317 return ;
318}
319
320 281
321 282
diff --git a/drivers/misc/mei/mei_dev.h b/drivers/misc/mei/mei_dev.h
index 11ff875e8658..d07d81ffbb57 100644
--- a/drivers/misc/mei/mei_dev.h
+++ b/drivers/misc/mei/mei_dev.h
@@ -328,7 +328,6 @@ void mei_reset(struct mei_device *dev, int interrupts);
328int mei_hw_init(struct mei_device *dev); 328int mei_hw_init(struct mei_device *dev);
329int mei_task_initialize_clients(void *data); 329int mei_task_initialize_clients(void *data);
330int mei_initialize_clients(struct mei_device *dev); 330int mei_initialize_clients(struct mei_device *dev);
331void mei_allocate_me_clients_storage(struct mei_device *dev);
332 331
333 332
334 333