Commit 70128792b7802efcf485e9b62249cf8a639187d8
1 parent
4fe9db3710
Exists in
smarc-l5.0.0_1.0.0-ga
and in
5 other branches
staging: csr: remove CsrMemAlloc()
It's just calling kmalloc(, GFP_KERNEL), so call that instead. A few places should be calling kzalloc(), so do that, and remove the call to memset at the same time. Cc: Mikko Virkkilä <mikko.virkkila@bluegiga.com> Cc: Lauri Hintsala <Lauri.Hintsala@bluegiga.com> Cc: Riku Mettälä <riku.mettala@bluegiga.com> Cc: Veli-Pekka Peltola <veli-pekka.peltola@bluegiga.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Showing 7 changed files with 12 additions and 62 deletions Side-by-side Diff
drivers/staging/csr/csr_framework_ext.c
... | ... | @@ -178,24 +178,6 @@ |
178 | 178 | |
179 | 179 | /*----------------------------------------------------------------------------* |
180 | 180 | * NAME |
181 | - * CsrMemAlloc | |
182 | - * | |
183 | - * DESCRIPTION | |
184 | - * Allocate dynamic memory of a given size. | |
185 | - * | |
186 | - * RETURNS | |
187 | - * Pointer to allocated memory, or NULL in case of failure. | |
188 | - * Allocated memory is not initialised. | |
189 | - * | |
190 | - *----------------------------------------------------------------------------*/ | |
191 | -void *CsrMemAlloc(size_t size) | |
192 | -{ | |
193 | - return kmalloc(size, GFP_KERNEL); | |
194 | -} | |
195 | -EXPORT_SYMBOL_GPL(CsrMemAlloc); | |
196 | - | |
197 | -/*----------------------------------------------------------------------------* | |
198 | - * NAME | |
199 | 181 | * CsrMemAllocDma |
200 | 182 | * |
201 | 183 | * DESCRIPTION |
drivers/staging/csr/csr_framework_ext.h
... | ... | @@ -244,26 +244,6 @@ |
244 | 244 | #ifndef CSR_PMEM_DEBUG_ENABLE |
245 | 245 | /*----------------------------------------------------------------------------* |
246 | 246 | * NAME |
247 | - * CsrMemAlloc | |
248 | - * | |
249 | - * DESCRIPTION | |
250 | - * Allocate dynamic memory of a given size. | |
251 | - * | |
252 | - * RETURNS | |
253 | - * Pointer to allocated memory, or NULL in case of failure. | |
254 | - * Allocated memory is not initialised. | |
255 | - * | |
256 | - *----------------------------------------------------------------------------*/ | |
257 | -#ifdef CSR_MEM_DEBUG | |
258 | -void *CsrMemAllocDebug(size_t size, | |
259 | - const char *file, u32 line); | |
260 | -#define CsrMemAlloc(sz) CsrMemAllocDebug((sz), __FILE__, __LINE__) | |
261 | -#else | |
262 | -void *CsrMemAlloc(size_t size); | |
263 | -#endif | |
264 | - | |
265 | -/*----------------------------------------------------------------------------* | |
266 | - * NAME | |
267 | 247 | * CsrMemCalloc |
268 | 248 | * |
269 | 249 | * DESCRIPTION |
... | ... | @@ -307,8 +287,6 @@ |
307 | 287 | #else |
308 | 288 | |
309 | 289 | #include "csr_pmem.h" |
310 | - | |
311 | -#define CsrMemAlloc(size) CsrPmemDebugAlloc(size, CSR_PMEM_DEBUG_TYPE_MEM_ALLOC, __FILE__, __LINE__) | |
312 | 290 | |
313 | 291 | #define CsrMemCalloc(numberOfElements, elementSize) CsrPmemDebugAlloc((numberOfElements * elementSize), CSR_PMEM_DEBUG_TYPE_MEM_CALLOC, __FILE__, __LINE__) |
314 | 292 |
drivers/staging/csr/csr_wifi_hip_card_sdio.c
... | ... | @@ -73,14 +73,12 @@ |
73 | 73 | func_enter(); |
74 | 74 | |
75 | 75 | |
76 | - card = (card_t *)CsrMemAlloc(sizeof(card_t)); | |
76 | + card = kzalloc(sizeof(card_t), GFP_KERNEL); | |
77 | 77 | if (card == NULL) |
78 | 78 | { |
79 | 79 | return NULL; |
80 | 80 | } |
81 | - memset(card, 0, sizeof(card_t)); | |
82 | 81 | |
83 | - | |
84 | 82 | card->sdio_if = sdio; |
85 | 83 | card->ospriv = ospriv; |
86 | 84 | |
... | ... | @@ -1665,8 +1663,7 @@ |
1665 | 1663 | n = cfg_data->num_fromhost_data_slots; |
1666 | 1664 | |
1667 | 1665 | unifi_trace(card->ospriv, UDBG3, "Alloc from-host resources, %d slots.\n", n); |
1668 | - card->from_host_data = | |
1669 | - (slot_desc_t *)CsrMemAlloc(n * sizeof(slot_desc_t)); | |
1666 | + card->from_host_data = kmalloc(n * sizeof(slot_desc_t), GFP_KERNEL); | |
1670 | 1667 | if (card->from_host_data == NULL) |
1671 | 1668 | { |
1672 | 1669 | unifi_error(card->ospriv, "Failed to allocate memory for F-H bulk data array\n"); |
... | ... | @@ -1681,8 +1678,7 @@ |
1681 | 1678 | } |
1682 | 1679 | |
1683 | 1680 | /* Allocate memory for the array used for slot host tag mapping */ |
1684 | - card->fh_slot_host_tag_record = | |
1685 | - (u32 *)CsrMemAlloc(n * sizeof(u32)); | |
1681 | + card->fh_slot_host_tag_record = kmalloc(n * sizeof(u32), GFP_KERNEL); | |
1686 | 1682 | |
1687 | 1683 | if (card->fh_slot_host_tag_record == NULL) |
1688 | 1684 | { |
... | ... | @@ -1702,8 +1698,7 @@ |
1702 | 1698 | n = cfg_data->num_tohost_data_slots; |
1703 | 1699 | |
1704 | 1700 | unifi_trace(card->ospriv, UDBG3, "Alloc to-host resources, %d slots.\n", n); |
1705 | - card->to_host_data = | |
1706 | - (bulk_data_desc_t *)CsrMemAlloc(n * sizeof(bulk_data_desc_t)); | |
1701 | + card->to_host_data = kmalloc(n * sizeof(bulk_data_desc_t), GFP_KERNEL); | |
1707 | 1702 | if (card->to_host_data == NULL) |
1708 | 1703 | { |
1709 | 1704 | unifi_error(card->ospriv, "Failed to allocate memory for T-H bulk data array\n"); |
drivers/staging/csr/csr_wifi_hip_download.c
... | ... | @@ -327,7 +327,7 @@ |
327 | 327 | |
328 | 328 | func_enter(); |
329 | 329 | |
330 | - fwinfo = CsrMemAlloc(sizeof(xbv1_t)); | |
330 | + fwinfo = kmalloc(sizeof(xbv1_t), GFP_KERNEL); | |
331 | 331 | if (fwinfo == NULL) |
332 | 332 | { |
333 | 333 | unifi_error(card->ospriv, "Failed to allocate memory for firmware\n"); |
... | ... | @@ -409,7 +409,7 @@ |
409 | 409 | |
410 | 410 | unifi_info(card->ospriv, "unifi_dl_patch %p %08x\n", dlpriv, boot_ctrl); |
411 | 411 | |
412 | - fwinfo = CsrMemAlloc(sizeof(xbv1_t)); | |
412 | + fwinfo = kmalloc(sizeof(xbv1_t), GFP_KERNEL); | |
413 | 413 | if (fwinfo == NULL) |
414 | 414 | { |
415 | 415 | unifi_error(card->ospriv, "Failed to allocate memory for patches\n"); |
drivers/staging/csr/csr_wifi_hip_dump.c
... | ... | @@ -667,24 +667,19 @@ |
667 | 667 | u32 zone_size; |
668 | 668 | |
669 | 669 | /* Allocate node header */ |
670 | - newnode = (coredump_buffer *)CsrMemAlloc(sizeof(coredump_buffer)); | |
670 | + newnode = kzalloc(sizeof(coredump_buffer), GFP_KERNEL); | |
671 | 671 | if (newnode == NULL) |
672 | 672 | { |
673 | 673 | return NULL; |
674 | 674 | } |
675 | - memset(newnode, 0, sizeof(coredump_buffer)); | |
676 | 675 | |
677 | 676 | /* Allocate chip memory zone capture buffers */ |
678 | 677 | for (i = 0; i < HIP_CDUMP_NUM_ZONES; i++) |
679 | 678 | { |
680 | 679 | zone_size = sizeof(u16) * zonedef_table[i].length; |
681 | - newzone = (u16 *)CsrMemAlloc(zone_size); | |
680 | + newzone = kzalloc(zone_size, GFP_KERNEL); | |
682 | 681 | newnode->zone[i] = newzone; |
683 | - if (newzone != NULL) | |
684 | - { | |
685 | - memset(newzone, 0, zone_size); | |
686 | - } | |
687 | - else | |
682 | + if (newzone == NULL) | |
688 | 683 | { |
689 | 684 | unifi_error(ospriv, "Out of memory on coredump zone %d (%d words)\n", |
690 | 685 | i, zonedef_table[i].length); |
drivers/staging/csr/csr_wifi_hip_xbv.c
... | ... | @@ -994,7 +994,7 @@ |
994 | 994 | } |
995 | 995 | |
996 | 996 | /* Pre-allocate read buffer for chunk conversion */ |
997 | - rdbuf = CsrMemAlloc(PTDL_MAX_SIZE); | |
997 | + rdbuf = kmalloc(PTDL_MAX_SIZE, GFP_KERNEL); | |
998 | 998 | if (!rdbuf) |
999 | 999 | { |
1000 | 1000 | unifi_error(card, "Couldn't alloc conversion buffer\n"); |
... | ... | @@ -1019,7 +1019,7 @@ |
1019 | 1019 | */ |
1020 | 1020 | patch_buf_size = calc_patch_size(fwinfo); |
1021 | 1021 | |
1022 | - patch_buf = (void *)CsrMemAlloc(patch_buf_size); | |
1022 | + patch_buf = kmalloc(patch_buf_size, GFP_KERNEL); | |
1023 | 1023 | if (!patch_buf) |
1024 | 1024 | { |
1025 | 1025 | kfree(rdbuf); |
drivers/staging/csr/io.c
... | ... | @@ -99,7 +99,7 @@ |
99 | 99 | for(i=0; i<size; i++) |
100 | 100 | { |
101 | 101 | priv->rxSignalBuffer.rx_buff[i].sig_len=0; |
102 | - priv->rxSignalBuffer.rx_buff[i].bufptr = CsrMemAlloc(UNIFI_PACKED_SIGBUF_SIZE); | |
102 | + priv->rxSignalBuffer.rx_buff[i].bufptr = kmalloc(UNIFI_PACKED_SIGBUF_SIZE, GFP_KERNEL); | |
103 | 103 | if (priv->rxSignalBuffer.rx_buff[i].bufptr == NULL) |
104 | 104 | { |
105 | 105 | int j; |