blob: db01e9b80bd1b0307bc0e99b4441e44d66146876 [file] [log] [blame]
Katish Paran244514d2013-08-01 18:39:31 -07001/* Copyright (c) 2008-2014, The Linux Foundation. All rights reserved.
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 */
13
14#include <linux/init.h>
15#include <linux/module.h>
16#include <linux/mempool.h>
17#include <linux/mutex.h>
18#include <asm/atomic.h>
19#include "diagchar.h"
Shalabh Jainb0037c02013-01-18 12:47:40 -080020#include "diagfwd_bridge.h"
21#include "diagfwd_hsic.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070022
Ravi Aravamudhan46df7d22013-06-12 11:57:07 -070023mempool_t *diag_pools_array[NUM_MEMORY_POOLS];
24
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070025void *diagmem_alloc(struct diagchar_dev *driver, int size, int pool_type)
26{
27 void *buf = NULL;
Ravi Aravamudhan850b4c92013-07-03 17:57:52 -070028 unsigned long flags;
Shalabh Jainb0037c02013-01-18 12:47:40 -080029 int index;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070030
Ravi Aravamudhan850b4c92013-07-03 17:57:52 -070031 spin_lock_irqsave(&driver->diag_mem_lock, flags);
Shalabh Jainb0037c02013-01-18 12:47:40 -080032 index = 0;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070033 if (pool_type == POOL_TYPE_COPY) {
34 if (driver->diagpool) {
Ravi Aravamudhand995a7f2013-07-03 13:06:15 -070035 if ((driver->count < driver->poolsize) &&
36 (size <= driver->itemsize)) {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070037 atomic_add(1, (atomic_t *)&driver->count);
38 buf = mempool_alloc(driver->diagpool,
39 GFP_ATOMIC);
40 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070041 }
42 } else if (pool_type == POOL_TYPE_HDLC) {
43 if (driver->diag_hdlc_pool) {
Ravi Aravamudhand995a7f2013-07-03 13:06:15 -070044 if ((driver->count_hdlc_pool < driver->poolsize_hdlc) &&
45 (size <= driver->itemsize_hdlc)) {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070046 atomic_add(1,
47 (atomic_t *)&driver->count_hdlc_pool);
48 buf = mempool_alloc(driver->diag_hdlc_pool,
49 GFP_ATOMIC);
50 }
51 }
Dixon Peterson6dba7572013-04-12 18:45:16 -070052 } else if (pool_type == POOL_TYPE_USER) {
53 if (driver->diag_user_pool) {
Ravi Aravamudhand995a7f2013-07-03 13:06:15 -070054 if ((driver->count_user_pool < driver->poolsize_user) &&
55 (size <= driver->itemsize_user)) {
Dixon Peterson6dba7572013-04-12 18:45:16 -070056 atomic_add(1,
57 (atomic_t *)&driver->count_user_pool);
58 buf = mempool_alloc(driver->diag_user_pool,
59 GFP_ATOMIC);
60 }
61 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070062 } else if (pool_type == POOL_TYPE_WRITE_STRUCT) {
63 if (driver->diag_write_struct_pool) {
Ravi Aravamudhand995a7f2013-07-03 13:06:15 -070064 if ((driver->count_write_struct_pool <
65 driver->poolsize_write_struct) &&
66 (size <= driver->itemsize_write_struct)) {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070067 atomic_add(1,
68 (atomic_t *)&driver->count_write_struct_pool);
69 buf = mempool_alloc(
70 driver->diag_write_struct_pool, GFP_ATOMIC);
71 }
72 }
Katish Paran244514d2013-08-01 18:39:31 -070073 } else if (pool_type == POOL_TYPE_DCI) {
74 if (driver->diag_dci_pool) {
75 if ((driver->count_dci_pool < driver->poolsize_dci) &&
76 (size <= driver->itemsize_dci)) {
77 atomic_add(1,
78 (atomic_t *)&driver->count_dci_pool);
79 buf = mempool_alloc(driver->diag_dci_pool,
80 GFP_ATOMIC);
81 }
82 }
Shalabh Jain737fca72012-11-14 21:53:43 -080083#ifdef CONFIG_DIAGFWD_BRIDGE_CODE
Shalabh Jainb0037c02013-01-18 12:47:40 -080084 } else if (pool_type == POOL_TYPE_HSIC ||
85 pool_type == POOL_TYPE_HSIC_2) {
86 index = pool_type - POOL_TYPE_HSIC;
87 if (diag_hsic[index].diag_hsic_pool) {
Ravi Aravamudhand995a7f2013-07-03 13:06:15 -070088 if ((diag_hsic[index].count_hsic_pool <
89 diag_hsic[index].poolsize_hsic) &&
90 (size <= diag_hsic[index].itemsize_hsic)) {
Shalabh Jainb0037c02013-01-18 12:47:40 -080091 atomic_add(1, (atomic_t *)
92 &diag_hsic[index].count_hsic_pool);
93 buf = mempool_alloc(
94 diag_hsic[index].diag_hsic_pool,
95 GFP_ATOMIC);
Dixon Peterson938f8602012-08-17 20:02:57 -070096 }
97 }
Shalabh Jainb0037c02013-01-18 12:47:40 -080098 } else if (pool_type == POOL_TYPE_HSIC_WRITE ||
99 pool_type == POOL_TYPE_HSIC_2_WRITE) {
100 index = pool_type - POOL_TYPE_HSIC_WRITE;
101 if (diag_hsic[index].diag_hsic_write_pool) {
102 if (diag_hsic[index].count_hsic_write_pool <
Ravi Aravamudhand995a7f2013-07-03 13:06:15 -0700103 diag_hsic[index].poolsize_hsic_write &&
104 (size <= diag_hsic[index].itemsize_hsic_write)) {
Dixon Peterson938f8602012-08-17 20:02:57 -0700105 atomic_add(1, (atomic_t *)
Shalabh Jainb0037c02013-01-18 12:47:40 -0800106 &diag_hsic[index].
107 count_hsic_write_pool);
Dixon Peterson938f8602012-08-17 20:02:57 -0700108 buf = mempool_alloc(
Shalabh Jainb0037c02013-01-18 12:47:40 -0800109 diag_hsic[index].diag_hsic_write_pool,
Dixon Peterson938f8602012-08-17 20:02:57 -0700110 GFP_ATOMIC);
111 }
112 }
113#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700114 }
Ravi Aravamudhan850b4c92013-07-03 17:57:52 -0700115 spin_unlock_irqrestore(&driver->diag_mem_lock, flags);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700116 return buf;
117}
118
119void diagmem_exit(struct diagchar_dev *driver, int pool_type)
120{
Shalabh Jainb0037c02013-01-18 12:47:40 -0800121 int index;
Ravi Aravamudhan850b4c92013-07-03 17:57:52 -0700122 unsigned long flags;
Shalabh Jainb0037c02013-01-18 12:47:40 -0800123 index = 0;
124
Ravi Aravamudhan850b4c92013-07-03 17:57:52 -0700125 spin_lock_irqsave(&driver->diag_mem_lock, flags);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700126 if (driver->diagpool) {
127 if (driver->count == 0 && driver->ref_count == 0) {
128 mempool_destroy(driver->diagpool);
129 driver->diagpool = NULL;
Shalabh Jainb0037c02013-01-18 12:47:40 -0800130 } else if (driver->ref_count == 0 && pool_type ==
Dixon Peterson6dba7572013-04-12 18:45:16 -0700131 POOL_TYPE_ALL) {
132 pr_err("diag: Unable to destroy COPY mempool");
133 }
Dixon Peterson938f8602012-08-17 20:02:57 -0700134 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700135
136 if (driver->diag_hdlc_pool) {
137 if (driver->count_hdlc_pool == 0 && driver->ref_count == 0) {
138 mempool_destroy(driver->diag_hdlc_pool);
139 driver->diag_hdlc_pool = NULL;
Shalabh Jainb0037c02013-01-18 12:47:40 -0800140 } else if (driver->ref_count == 0 && pool_type ==
Dixon Peterson6dba7572013-04-12 18:45:16 -0700141 POOL_TYPE_ALL) {
142 pr_err("diag: Unable to destroy HDLC mempool");
143 }
144 }
145
146 if (driver->diag_user_pool) {
147 if (driver->count_user_pool == 0 && driver->ref_count == 0) {
148 mempool_destroy(driver->diag_user_pool);
149 driver->diag_user_pool = NULL;
150 } else if (driver->ref_count == 0 && pool_type ==
151 POOL_TYPE_ALL) {
152 pr_err("diag: Unable to destroy USER mempool");
153 }
Dixon Peterson938f8602012-08-17 20:02:57 -0700154 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700155
156 if (driver->diag_write_struct_pool) {
157 /* Free up struct pool ONLY if there are no outstanding
158 transactions(aggregation buffer) with USB */
159 if (driver->count_write_struct_pool == 0 &&
160 driver->count_hdlc_pool == 0 && driver->ref_count == 0) {
161 mempool_destroy(driver->diag_write_struct_pool);
162 driver->diag_write_struct_pool = NULL;
Shalabh Jainb0037c02013-01-18 12:47:40 -0800163 } else if (driver->ref_count == 0 && pool_type ==
Dixon Peterson6dba7572013-04-12 18:45:16 -0700164 POOL_TYPE_ALL) {
165 pr_err("diag: Unable to destroy STRUCT mempool");
166 }
Dixon Peterson938f8602012-08-17 20:02:57 -0700167 }
Katish Paran244514d2013-08-01 18:39:31 -0700168
169 if (driver->diag_dci_pool) {
170 if (driver->count_dci_pool == 0 && driver->ref_count == 0) {
171 mempool_destroy(driver->diag_dci_pool);
172 driver->diag_dci_pool = NULL;
173 } else if (driver->ref_count == 0 && pool_type ==
174 POOL_TYPE_ALL) {
175 pr_err("diag: Unable to destroy DCI mempool");
176 }
177 }
Shalabh Jain737fca72012-11-14 21:53:43 -0800178#ifdef CONFIG_DIAGFWD_BRIDGE_CODE
Shalabh Jainb0037c02013-01-18 12:47:40 -0800179 for (index = 0; index < MAX_HSIC_CH; index++) {
180 if (diag_hsic[index].diag_hsic_pool &&
181 (diag_hsic[index].hsic_inited == 0)) {
182 if (diag_hsic[index].count_hsic_pool == 0) {
Ravi Aravamudhan66b02932013-06-26 16:15:21 -0700183 mempool_destroy(
184 diag_hsic[index].diag_hsic_pool);
185 diag_hsic[index].diag_hsic_pool = NULL;
Shalabh Jainb0037c02013-01-18 12:47:40 -0800186 } else if (pool_type == POOL_TYPE_ALL)
187 pr_err("Unable to destroy HDLC mempool for ch %d"
188 , index);
189 }
Dixon Peterson938f8602012-08-17 20:02:57 -0700190
Shalabh Jainb0037c02013-01-18 12:47:40 -0800191 if (diag_hsic[index].diag_hsic_write_pool &&
Dixon Peterson175f1c12013-02-08 18:51:42 -0800192 (diag_hsic[index].hsic_inited == 0)) {
Shalabh Jainb0037c02013-01-18 12:47:40 -0800193 /*
194 * Free up struct pool ONLY if there are no outstanding
195 * transactions(aggregation buffer) with USB
196 */
197 if (diag_hsic[index].count_hsic_write_pool == 0 &&
198 diag_hsic[index].count_hsic_pool == 0) {
199 mempool_destroy(
200 diag_hsic[index].diag_hsic_write_pool);
201 diag_hsic[index].diag_hsic_write_pool = NULL;
202 } else if (pool_type == POOL_TYPE_ALL)
203 pr_err("Unable to destroy HSIC USB struct mempool for ch %d"
204 , index);
205 }
Dixon Peterson938f8602012-08-17 20:02:57 -0700206 }
207#endif
Ravi Aravamudhan850b4c92013-07-03 17:57:52 -0700208 spin_unlock_irqrestore(&driver->diag_mem_lock, flags);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700209}
210
211void diagmem_free(struct diagchar_dev *driver, void *buf, int pool_type)
212{
Shalabh Jainb0037c02013-01-18 12:47:40 -0800213 int index;
Ravi Aravamudhan850b4c92013-07-03 17:57:52 -0700214 unsigned long flags;
Shalabh Jainb0037c02013-01-18 12:47:40 -0800215
Ravi Aravamudhan850b4c92013-07-03 17:57:52 -0700216 if (!buf)
217 return;
218
219 spin_lock_irqsave(&driver->diag_mem_lock, flags);
Shalabh Jainb0037c02013-01-18 12:47:40 -0800220 index = 0;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700221 if (pool_type == POOL_TYPE_COPY) {
222 if (driver->diagpool != NULL && driver->count > 0) {
223 mempool_free(buf, driver->diagpool);
224 atomic_add(-1, (atomic_t *)&driver->count);
225 } else
Dixon Peterson6dba7572013-04-12 18:45:16 -0700226 pr_err("diag: Attempt to free up DIAG driver mempool memory which is already free %d",
227 driver->count);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700228 } else if (pool_type == POOL_TYPE_HDLC) {
229 if (driver->diag_hdlc_pool != NULL &&
230 driver->count_hdlc_pool > 0) {
231 mempool_free(buf, driver->diag_hdlc_pool);
232 atomic_add(-1, (atomic_t *)&driver->count_hdlc_pool);
233 } else
Dixon Peterson6dba7572013-04-12 18:45:16 -0700234 pr_err("diag: Attempt to free up DIAG driver HDLC mempool which is already free %d ",
235 driver->count_hdlc_pool);
236 } else if (pool_type == POOL_TYPE_USER) {
237 if (driver->diag_user_pool != NULL &&
238 driver->count_user_pool > 0) {
239 mempool_free(buf, driver->diag_user_pool);
240 atomic_add(-1, (atomic_t *)&driver->count_user_pool);
241 } else {
242 pr_err("diag: Attempt to free up DIAG driver USER mempool which is already free %d ",
243 driver->count_user_pool);
244 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700245 } else if (pool_type == POOL_TYPE_WRITE_STRUCT) {
246 if (driver->diag_write_struct_pool != NULL &&
247 driver->count_write_struct_pool > 0) {
248 mempool_free(buf, driver->diag_write_struct_pool);
249 atomic_add(-1,
250 (atomic_t *)&driver->count_write_struct_pool);
251 } else
Dixon Peterson6dba7572013-04-12 18:45:16 -0700252 pr_err("diag: Attempt to free up DIAG driver USB structure mempool which is already free %d ",
253 driver->count_write_struct_pool);
Katish Paran244514d2013-08-01 18:39:31 -0700254 } else if (pool_type == POOL_TYPE_DCI) {
255 if (driver->diag_dci_pool != NULL &&
256 driver->count_dci_pool > 0) {
257 mempool_free(buf, driver->diag_dci_pool);
258 atomic_add(-1,
259 (atomic_t *)&driver->count_dci_pool);
260 } else
261 pr_err("diag: Attempt to free up DIAG driver DCI mempool which is already free %d ",
262 driver->count_dci_pool);
Shalabh Jain737fca72012-11-14 21:53:43 -0800263#ifdef CONFIG_DIAGFWD_BRIDGE_CODE
Shalabh Jainb0037c02013-01-18 12:47:40 -0800264 } else if (pool_type == POOL_TYPE_HSIC ||
265 pool_type == POOL_TYPE_HSIC_2) {
266 index = pool_type - POOL_TYPE_HSIC;
267 if (diag_hsic[index].diag_hsic_pool != NULL &&
268 diag_hsic[index].count_hsic_pool > 0) {
269 mempool_free(buf, diag_hsic[index].diag_hsic_pool);
270 atomic_add(-1, (atomic_t *)
271 &diag_hsic[index].count_hsic_pool);
Dixon Peterson938f8602012-08-17 20:02:57 -0700272 } else
Shalabh Jainb0037c02013-01-18 12:47:40 -0800273 pr_err("diag: Attempt to free up DIAG driver HSIC mempool which is already free %d, ch = %d",
274 diag_hsic[index].count_hsic_pool, index);
275 } else if (pool_type == POOL_TYPE_HSIC_WRITE ||
276 pool_type == POOL_TYPE_HSIC_2_WRITE) {
277 index = pool_type - POOL_TYPE_HSIC_WRITE;
278 if (diag_hsic[index].diag_hsic_write_pool != NULL &&
279 diag_hsic[index].count_hsic_write_pool > 0) {
280 mempool_free(buf,
281 diag_hsic[index].diag_hsic_write_pool);
282 atomic_add(-1, (atomic_t *)
283 &diag_hsic[index].count_hsic_write_pool);
Dixon Peterson938f8602012-08-17 20:02:57 -0700284 } else
Shalabh Jainb0037c02013-01-18 12:47:40 -0800285 pr_err("diag: Attempt to free up DIAG driver HSIC USB structure mempool which is already free %d, ch = %d",
286 driver->count_write_struct_pool, index);
Dixon Peterson938f8602012-08-17 20:02:57 -0700287#endif
288 } else {
289 pr_err("diag: In %s, unknown pool type: %d\n",
290 __func__, pool_type);
291
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700292 }
Ravi Aravamudhan850b4c92013-07-03 17:57:52 -0700293 spin_unlock_irqrestore(&driver->diag_mem_lock, flags);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700294 diagmem_exit(driver, pool_type);
295}
296
297void diagmem_init(struct diagchar_dev *driver)
298{
Ravi Aravamudhan850b4c92013-07-03 17:57:52 -0700299 spin_lock_init(&driver->diag_mem_lock);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700300
Ravi Aravamudhan46df7d22013-06-12 11:57:07 -0700301 if (driver->count == 0) {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700302 driver->diagpool = mempool_create_kmalloc_pool(
303 driver->poolsize, driver->itemsize);
Ravi Aravamudhan46df7d22013-06-12 11:57:07 -0700304 diag_pools_array[POOL_COPY_IDX] = driver->diagpool;
305 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700306
Ravi Aravamudhan46df7d22013-06-12 11:57:07 -0700307 if (driver->count_hdlc_pool == 0) {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700308 driver->diag_hdlc_pool = mempool_create_kmalloc_pool(
309 driver->poolsize_hdlc, driver->itemsize_hdlc);
Ravi Aravamudhan46df7d22013-06-12 11:57:07 -0700310 diag_pools_array[POOL_HDLC_IDX] = driver->diag_hdlc_pool;
311 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700312
Ravi Aravamudhan46df7d22013-06-12 11:57:07 -0700313 if (driver->count_user_pool == 0) {
Dixon Peterson6dba7572013-04-12 18:45:16 -0700314 driver->diag_user_pool = mempool_create_kmalloc_pool(
315 driver->poolsize_user, driver->itemsize_user);
Ravi Aravamudhan46df7d22013-06-12 11:57:07 -0700316 diag_pools_array[POOL_USER_IDX] = driver->diag_user_pool;
317 }
Dixon Peterson6dba7572013-04-12 18:45:16 -0700318
Ravi Aravamudhan46df7d22013-06-12 11:57:07 -0700319 if (driver->count_write_struct_pool == 0) {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700320 driver->diag_write_struct_pool = mempool_create_kmalloc_pool(
321 driver->poolsize_write_struct, driver->itemsize_write_struct);
Ravi Aravamudhan46df7d22013-06-12 11:57:07 -0700322 diag_pools_array[POOL_WRITE_STRUCT_IDX] =
323 driver->diag_write_struct_pool;
324 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700325
Katish Paran244514d2013-08-01 18:39:31 -0700326 if (driver->count_dci_pool == 0) {
327 driver->diag_dci_pool = mempool_create_kmalloc_pool(
328 driver->poolsize_dci, driver->itemsize_dci);
329 diag_pools_array[POOL_DCI_IDX] = driver->diag_dci_pool;
330 }
331
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700332 if (!driver->diagpool)
Dixon Peterson6dba7572013-04-12 18:45:16 -0700333 pr_err("diag: Cannot allocate diag mempool\n");
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700334
335 if (!driver->diag_hdlc_pool)
Dixon Peterson6dba7572013-04-12 18:45:16 -0700336 pr_err("diag: Cannot allocate diag HDLC mempool\n");
337
338 if (!driver->diag_user_pool)
339 pr_err("diag: Cannot allocate diag USER mempool\n");
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700340
341 if (!driver->diag_write_struct_pool)
Dixon Peterson6dba7572013-04-12 18:45:16 -0700342 pr_err("diag: Cannot allocate diag USB struct mempool\n");
Katish Paran244514d2013-08-01 18:39:31 -0700343
344 if (!driver->diag_dci_pool)
345 pr_err("diag: Cannot allocate diag DCI mempool\n");
346
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700347}
348
Shalabh Jain737fca72012-11-14 21:53:43 -0800349#ifdef CONFIG_DIAGFWD_BRIDGE_CODE
Shalabh Jainb0037c02013-01-18 12:47:40 -0800350void diagmem_hsic_init(int index)
Dixon Peterson938f8602012-08-17 20:02:57 -0700351{
Ravi Aravamudhan46df7d22013-06-12 11:57:07 -0700352 if (index < 0 || index >= MAX_HSIC_CH) {
353 pr_err("diag: Invalid hsic index in %s\n", __func__);
354 return;
355 }
356
357 if (diag_hsic[index].count_hsic_pool == 0) {
Shalabh Jainb0037c02013-01-18 12:47:40 -0800358 diag_hsic[index].diag_hsic_pool = mempool_create_kmalloc_pool(
359 diag_hsic[index].poolsize_hsic,
360 diag_hsic[index].itemsize_hsic);
Ravi Aravamudhan46df7d22013-06-12 11:57:07 -0700361 diag_pools_array[POOL_HSIC_IDX + index] =
362 diag_hsic[index].diag_hsic_pool;
363 }
Dixon Peterson938f8602012-08-17 20:02:57 -0700364
Ravi Aravamudhan46df7d22013-06-12 11:57:07 -0700365 if (diag_hsic[index].count_hsic_write_pool == 0) {
Shalabh Jainb0037c02013-01-18 12:47:40 -0800366 diag_hsic[index].diag_hsic_write_pool =
367 mempool_create_kmalloc_pool(
368 diag_hsic[index].poolsize_hsic_write,
369 diag_hsic[index].itemsize_hsic_write);
Ravi Aravamudhan46df7d22013-06-12 11:57:07 -0700370 diag_pools_array[POOL_HSIC_WRITE_IDX + index] =
371 diag_hsic[index].diag_hsic_write_pool;
372 }
Dixon Peterson938f8602012-08-17 20:02:57 -0700373
Shalabh Jainb0037c02013-01-18 12:47:40 -0800374 if (!diag_hsic[index].diag_hsic_pool)
375 pr_err("Cannot allocate diag HSIC mempool for ch %d\n", index);
Dixon Peterson938f8602012-08-17 20:02:57 -0700376
Shalabh Jainb0037c02013-01-18 12:47:40 -0800377 if (!diag_hsic[index].diag_hsic_write_pool)
378 pr_err("Cannot allocate diag HSIC struct mempool for ch %d\n",
379 index);
Dixon Peterson938f8602012-08-17 20:02:57 -0700380
381}
382#endif
383