aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-07-20 18:37:12 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-07-20 18:37:12 -0400
commit70128792b7802efcf485e9b62249cf8a639187d8 (patch)
tree22453e906c9796628b84256944786db506450cf3 /drivers/staging
parent4fe9db37104f833972486355fe86d7dcd29279b5 (diff)
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>
Diffstat (limited to 'drivers/staging')
-rw-r--r--drivers/staging/csr/csr_framework_ext.c18
-rw-r--r--drivers/staging/csr/csr_framework_ext.h22
-rw-r--r--drivers/staging/csr/csr_wifi_hip_card_sdio.c13
-rw-r--r--drivers/staging/csr/csr_wifi_hip_download.c4
-rw-r--r--drivers/staging/csr/csr_wifi_hip_dump.c11
-rw-r--r--drivers/staging/csr/csr_wifi_hip_xbv.c4
-rw-r--r--drivers/staging/csr/io.c2
7 files changed, 12 insertions, 62 deletions
diff --git a/drivers/staging/csr/csr_framework_ext.c b/drivers/staging/csr/csr_framework_ext.c
index 22345e80467f..a34d2632ae22 100644
--- a/drivers/staging/csr/csr_framework_ext.c
+++ b/drivers/staging/csr/csr_framework_ext.c
@@ -178,24 +178,6 @@ void *CsrMemCalloc(size_t numberOfElements, size_t elementSize)
178 178
179/*----------------------------------------------------------------------------* 179/*----------------------------------------------------------------------------*
180 * NAME 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 *----------------------------------------------------------------------------*/
191void *CsrMemAlloc(size_t size)
192{
193 return kmalloc(size, GFP_KERNEL);
194}
195EXPORT_SYMBOL_GPL(CsrMemAlloc);
196
197/*----------------------------------------------------------------------------*
198 * NAME
199 * CsrMemAllocDma 181 * CsrMemAllocDma
200 * 182 *
201 * DESCRIPTION 183 * DESCRIPTION
diff --git a/drivers/staging/csr/csr_framework_ext.h b/drivers/staging/csr/csr_framework_ext.h
index a3fc15299075..141f2884688f 100644
--- a/drivers/staging/csr/csr_framework_ext.h
+++ b/drivers/staging/csr/csr_framework_ext.h
@@ -244,26 +244,6 @@ void CsrThreadSleep(u16 sleepTimeInMs);
244#ifndef CSR_PMEM_DEBUG_ENABLE 244#ifndef CSR_PMEM_DEBUG_ENABLE
245/*----------------------------------------------------------------------------* 245/*----------------------------------------------------------------------------*
246 * NAME 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
258void *CsrMemAllocDebug(size_t size,
259 const char *file, u32 line);
260#define CsrMemAlloc(sz) CsrMemAllocDebug((sz), __FILE__, __LINE__)
261#else
262void *CsrMemAlloc(size_t size);
263#endif
264
265/*----------------------------------------------------------------------------*
266 * NAME
267 * CsrMemCalloc 247 * CsrMemCalloc
268 * 248 *
269 * DESCRIPTION 249 * DESCRIPTION
@@ -308,8 +288,6 @@ void *CsrMemAllocDma(size_t size);
308 288
309#include "csr_pmem.h" 289#include "csr_pmem.h"
310 290
311#define CsrMemAlloc(size) CsrPmemDebugAlloc(size, CSR_PMEM_DEBUG_TYPE_MEM_ALLOC, __FILE__, __LINE__)
312
313#define CsrMemCalloc(numberOfElements, elementSize) CsrPmemDebugAlloc((numberOfElements * elementSize), CSR_PMEM_DEBUG_TYPE_MEM_CALLOC, __FILE__, __LINE__) 291#define CsrMemCalloc(numberOfElements, elementSize) CsrPmemDebugAlloc((numberOfElements * elementSize), CSR_PMEM_DEBUG_TYPE_MEM_CALLOC, __FILE__, __LINE__)
314 292
315#define CsrMemAllocDma(size) CsrPmemDebugAlloc(size, CSR_PMEM_DEBUG_TYPE_MEM_ALLOC_DMA, __FILE__, __LINE__) 293#define CsrMemAllocDma(size) CsrPmemDebugAlloc(size, CSR_PMEM_DEBUG_TYPE_MEM_ALLOC_DMA, __FILE__, __LINE__)
diff --git a/drivers/staging/csr/csr_wifi_hip_card_sdio.c b/drivers/staging/csr/csr_wifi_hip_card_sdio.c
index 4f2d2e3e45bb..608a0690d5e0 100644
--- a/drivers/staging/csr/csr_wifi_hip_card_sdio.c
+++ b/drivers/staging/csr/csr_wifi_hip_card_sdio.c
@@ -73,13 +73,11 @@ card_t* unifi_alloc_card(CsrSdioFunction *sdio, void *ospriv)
73 func_enter(); 73 func_enter();
74 74
75 75
76 card = (card_t *)CsrMemAlloc(sizeof(card_t)); 76 card = kzalloc(sizeof(card_t), GFP_KERNEL);
77 if (card == NULL) 77 if (card == NULL)
78 { 78 {
79 return NULL; 79 return NULL;
80 } 80 }
81 memset(card, 0, sizeof(card_t));
82
83 81
84 card->sdio_if = sdio; 82 card->sdio_if = sdio;
85 card->ospriv = ospriv; 83 card->ospriv = ospriv;
@@ -1665,8 +1663,7 @@ static CsrResult card_allocate_memory_resources(card_t *card)
1665 n = cfg_data->num_fromhost_data_slots; 1663 n = cfg_data->num_fromhost_data_slots;
1666 1664
1667 unifi_trace(card->ospriv, UDBG3, "Alloc from-host resources, %d slots.\n", n); 1665 unifi_trace(card->ospriv, UDBG3, "Alloc from-host resources, %d slots.\n", n);
1668 card->from_host_data = 1666 card->from_host_data = kmalloc(n * sizeof(slot_desc_t), GFP_KERNEL);
1669 (slot_desc_t *)CsrMemAlloc(n * sizeof(slot_desc_t));
1670 if (card->from_host_data == NULL) 1667 if (card->from_host_data == NULL)
1671 { 1668 {
1672 unifi_error(card->ospriv, "Failed to allocate memory for F-H bulk data array\n"); 1669 unifi_error(card->ospriv, "Failed to allocate memory for F-H bulk data array\n");
@@ -1681,8 +1678,7 @@ static CsrResult card_allocate_memory_resources(card_t *card)
1681 } 1678 }
1682 1679
1683 /* Allocate memory for the array used for slot host tag mapping */ 1680 /* Allocate memory for the array used for slot host tag mapping */
1684 card->fh_slot_host_tag_record = 1681 card->fh_slot_host_tag_record = kmalloc(n * sizeof(u32), GFP_KERNEL);
1685 (u32 *)CsrMemAlloc(n * sizeof(u32));
1686 1682
1687 if (card->fh_slot_host_tag_record == NULL) 1683 if (card->fh_slot_host_tag_record == NULL)
1688 { 1684 {
@@ -1702,8 +1698,7 @@ static CsrResult card_allocate_memory_resources(card_t *card)
1702 n = cfg_data->num_tohost_data_slots; 1698 n = cfg_data->num_tohost_data_slots;
1703 1699
1704 unifi_trace(card->ospriv, UDBG3, "Alloc to-host resources, %d slots.\n", n); 1700 unifi_trace(card->ospriv, UDBG3, "Alloc to-host resources, %d slots.\n", n);
1705 card->to_host_data = 1701 card->to_host_data = kmalloc(n * sizeof(bulk_data_desc_t), GFP_KERNEL);
1706 (bulk_data_desc_t *)CsrMemAlloc(n * sizeof(bulk_data_desc_t));
1707 if (card->to_host_data == NULL) 1702 if (card->to_host_data == NULL)
1708 { 1703 {
1709 unifi_error(card->ospriv, "Failed to allocate memory for T-H bulk data array\n"); 1704 unifi_error(card->ospriv, "Failed to allocate memory for T-H bulk data array\n");
diff --git a/drivers/staging/csr/csr_wifi_hip_download.c b/drivers/staging/csr/csr_wifi_hip_download.c
index 1a1dfb628450..f0f0ffd89d62 100644
--- a/drivers/staging/csr/csr_wifi_hip_download.c
+++ b/drivers/staging/csr/csr_wifi_hip_download.c
@@ -327,7 +327,7 @@ CsrResult unifi_dl_firmware(card_t *card, void *dlpriv)
327 327
328 func_enter(); 328 func_enter();
329 329
330 fwinfo = CsrMemAlloc(sizeof(xbv1_t)); 330 fwinfo = kmalloc(sizeof(xbv1_t), GFP_KERNEL);
331 if (fwinfo == NULL) 331 if (fwinfo == NULL)
332 { 332 {
333 unifi_error(card->ospriv, "Failed to allocate memory for firmware\n"); 333 unifi_error(card->ospriv, "Failed to allocate memory for firmware\n");
@@ -409,7 +409,7 @@ CsrResult unifi_dl_patch(card_t *card, void *dlpriv, u32 boot_ctrl)
409 409
410 unifi_info(card->ospriv, "unifi_dl_patch %p %08x\n", dlpriv, boot_ctrl); 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 if (fwinfo == NULL) 413 if (fwinfo == NULL)
414 { 414 {
415 unifi_error(card->ospriv, "Failed to allocate memory for patches\n"); 415 unifi_error(card->ospriv, "Failed to allocate memory for patches\n");
diff --git a/drivers/staging/csr/csr_wifi_hip_dump.c b/drivers/staging/csr/csr_wifi_hip_dump.c
index 350d9d204488..d67b460e7a85 100644
--- a/drivers/staging/csr/csr_wifi_hip_dump.c
+++ b/drivers/staging/csr/csr_wifi_hip_dump.c
@@ -667,24 +667,19 @@ coredump_buffer* new_coredump_node(void *ospriv, coredump_buffer *prevnode)
667 u32 zone_size; 667 u32 zone_size;
668 668
669 /* Allocate node header */ 669 /* Allocate node header */
670 newnode = (coredump_buffer *)CsrMemAlloc(sizeof(coredump_buffer)); 670 newnode = kzalloc(sizeof(coredump_buffer), GFP_KERNEL);
671 if (newnode == NULL) 671 if (newnode == NULL)
672 { 672 {
673 return NULL; 673 return NULL;
674 } 674 }
675 memset(newnode, 0, sizeof(coredump_buffer));
676 675
677 /* Allocate chip memory zone capture buffers */ 676 /* Allocate chip memory zone capture buffers */
678 for (i = 0; i < HIP_CDUMP_NUM_ZONES; i++) 677 for (i = 0; i < HIP_CDUMP_NUM_ZONES; i++)
679 { 678 {
680 zone_size = sizeof(u16) * zonedef_table[i].length; 679 zone_size = sizeof(u16) * zonedef_table[i].length;
681 newzone = (u16 *)CsrMemAlloc(zone_size); 680 newzone = kzalloc(zone_size, GFP_KERNEL);
682 newnode->zone[i] = newzone; 681 newnode->zone[i] = newzone;
683 if (newzone != NULL) 682 if (newzone == NULL)
684 {
685 memset(newzone, 0, zone_size);
686 }
687 else
688 { 683 {
689 unifi_error(ospriv, "Out of memory on coredump zone %d (%d words)\n", 684 unifi_error(ospriv, "Out of memory on coredump zone %d (%d words)\n",
690 i, zonedef_table[i].length); 685 i, zonedef_table[i].length);
diff --git a/drivers/staging/csr/csr_wifi_hip_xbv.c b/drivers/staging/csr/csr_wifi_hip_xbv.c
index 3016e63e212c..071f80a49f19 100644
--- a/drivers/staging/csr/csr_wifi_hip_xbv.c
+++ b/drivers/staging/csr/csr_wifi_hip_xbv.c
@@ -994,7 +994,7 @@ void* xbv_to_patch(card_t *card, fwreadfn_t readfn,
994 } 994 }
995 995
996 /* Pre-allocate read buffer for chunk conversion */ 996 /* Pre-allocate read buffer for chunk conversion */
997 rdbuf = CsrMemAlloc(PTDL_MAX_SIZE); 997 rdbuf = kmalloc(PTDL_MAX_SIZE, GFP_KERNEL);
998 if (!rdbuf) 998 if (!rdbuf)
999 { 999 {
1000 unifi_error(card, "Couldn't alloc conversion buffer\n"); 1000 unifi_error(card, "Couldn't alloc conversion buffer\n");
@@ -1019,7 +1019,7 @@ void* xbv_to_patch(card_t *card, fwreadfn_t readfn,
1019 */ 1019 */
1020 patch_buf_size = calc_patch_size(fwinfo); 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 if (!patch_buf) 1023 if (!patch_buf)
1024 { 1024 {
1025 kfree(rdbuf); 1025 kfree(rdbuf);
diff --git a/drivers/staging/csr/io.c b/drivers/staging/csr/io.c
index 38b5f7ee6486..e6503d9620a4 100644
--- a/drivers/staging/csr/io.c
+++ b/drivers/staging/csr/io.c
@@ -99,7 +99,7 @@ static CsrResult signal_buffer_init(unifi_priv_t * priv, int size)
99 for(i=0; i<size; i++) 99 for(i=0; i<size; i++)
100 { 100 {
101 priv->rxSignalBuffer.rx_buff[i].sig_len=0; 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 if (priv->rxSignalBuffer.rx_buff[i].bufptr == NULL) 103 if (priv->rxSignalBuffer.rx_buff[i].bufptr == NULL)
104 { 104 {
105 int j; 105 int j;