summaryrefslogtreecommitdiff
path: root/drivers/staging/csr
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-07-21 02:37:12 +0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-07-21 02:37:12 +0400
commit70128792b7802efcf485e9b62249cf8a639187d8 (patch)
tree22453e906c9796628b84256944786db506450cf3 /drivers/staging/csr
parent4fe9db37104f833972486355fe86d7dcd29279b5 (diff)
downloadlinux-70128792b7802efcf485e9b62249cf8a639187d8.tar.xz
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/csr')
-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)
/*----------------------------------------------------------------------------*
* NAME
- * CsrMemAlloc
- *
- * DESCRIPTION
- * Allocate dynamic memory of a given size.
- *
- * RETURNS
- * Pointer to allocated memory, or NULL in case of failure.
- * Allocated memory is not initialised.
- *
- *----------------------------------------------------------------------------*/
-void *CsrMemAlloc(size_t size)
-{
- return kmalloc(size, GFP_KERNEL);
-}
-EXPORT_SYMBOL_GPL(CsrMemAlloc);
-
-/*----------------------------------------------------------------------------*
- * NAME
* CsrMemAllocDma
*
* 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);
#ifndef CSR_PMEM_DEBUG_ENABLE
/*----------------------------------------------------------------------------*
* NAME
- * CsrMemAlloc
- *
- * DESCRIPTION
- * Allocate dynamic memory of a given size.
- *
- * RETURNS
- * Pointer to allocated memory, or NULL in case of failure.
- * Allocated memory is not initialised.
- *
- *----------------------------------------------------------------------------*/
-#ifdef CSR_MEM_DEBUG
-void *CsrMemAllocDebug(size_t size,
- const char *file, u32 line);
-#define CsrMemAlloc(sz) CsrMemAllocDebug((sz), __FILE__, __LINE__)
-#else
-void *CsrMemAlloc(size_t size);
-#endif
-
-/*----------------------------------------------------------------------------*
- * NAME
* CsrMemCalloc
*
* DESCRIPTION
@@ -308,8 +288,6 @@ void *CsrMemAllocDma(size_t size);
#include "csr_pmem.h"
-#define CsrMemAlloc(size) CsrPmemDebugAlloc(size, CSR_PMEM_DEBUG_TYPE_MEM_ALLOC, __FILE__, __LINE__)
-
#define CsrMemCalloc(numberOfElements, elementSize) CsrPmemDebugAlloc((numberOfElements * elementSize), CSR_PMEM_DEBUG_TYPE_MEM_CALLOC, __FILE__, __LINE__)
#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)
func_enter();
- card = (card_t *)CsrMemAlloc(sizeof(card_t));
+ card = kzalloc(sizeof(card_t), GFP_KERNEL);
if (card == NULL)
{
return NULL;
}
- memset(card, 0, sizeof(card_t));
-
card->sdio_if = sdio;
card->ospriv = ospriv;
@@ -1665,8 +1663,7 @@ static CsrResult card_allocate_memory_resources(card_t *card)
n = cfg_data->num_fromhost_data_slots;
unifi_trace(card->ospriv, UDBG3, "Alloc from-host resources, %d slots.\n", n);
- card->from_host_data =
- (slot_desc_t *)CsrMemAlloc(n * sizeof(slot_desc_t));
+ card->from_host_data = kmalloc(n * sizeof(slot_desc_t), GFP_KERNEL);
if (card->from_host_data == NULL)
{
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)
}
/* Allocate memory for the array used for slot host tag mapping */
- card->fh_slot_host_tag_record =
- (u32 *)CsrMemAlloc(n * sizeof(u32));
+ card->fh_slot_host_tag_record = kmalloc(n * sizeof(u32), GFP_KERNEL);
if (card->fh_slot_host_tag_record == NULL)
{
@@ -1702,8 +1698,7 @@ static CsrResult card_allocate_memory_resources(card_t *card)
n = cfg_data->num_tohost_data_slots;
unifi_trace(card->ospriv, UDBG3, "Alloc to-host resources, %d slots.\n", n);
- card->to_host_data =
- (bulk_data_desc_t *)CsrMemAlloc(n * sizeof(bulk_data_desc_t));
+ card->to_host_data = kmalloc(n * sizeof(bulk_data_desc_t), GFP_KERNEL);
if (card->to_host_data == NULL)
{
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)
func_enter();
- fwinfo = CsrMemAlloc(sizeof(xbv1_t));
+ fwinfo = kmalloc(sizeof(xbv1_t), GFP_KERNEL);
if (fwinfo == NULL)
{
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)
unifi_info(card->ospriv, "unifi_dl_patch %p %08x\n", dlpriv, boot_ctrl);
- fwinfo = CsrMemAlloc(sizeof(xbv1_t));
+ fwinfo = kmalloc(sizeof(xbv1_t), GFP_KERNEL);
if (fwinfo == NULL)
{
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)
u32 zone_size;
/* Allocate node header */
- newnode = (coredump_buffer *)CsrMemAlloc(sizeof(coredump_buffer));
+ newnode = kzalloc(sizeof(coredump_buffer), GFP_KERNEL);
if (newnode == NULL)
{
return NULL;
}
- memset(newnode, 0, sizeof(coredump_buffer));
/* Allocate chip memory zone capture buffers */
for (i = 0; i < HIP_CDUMP_NUM_ZONES; i++)
{
zone_size = sizeof(u16) * zonedef_table[i].length;
- newzone = (u16 *)CsrMemAlloc(zone_size);
+ newzone = kzalloc(zone_size, GFP_KERNEL);
newnode->zone[i] = newzone;
- if (newzone != NULL)
- {
- memset(newzone, 0, zone_size);
- }
- else
+ if (newzone == NULL)
{
unifi_error(ospriv, "Out of memory on coredump zone %d (%d words)\n",
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,
}
/* Pre-allocate read buffer for chunk conversion */
- rdbuf = CsrMemAlloc(PTDL_MAX_SIZE);
+ rdbuf = kmalloc(PTDL_MAX_SIZE, GFP_KERNEL);
if (!rdbuf)
{
unifi_error(card, "Couldn't alloc conversion buffer\n");
@@ -1019,7 +1019,7 @@ void* xbv_to_patch(card_t *card, fwreadfn_t readfn,
*/
patch_buf_size = calc_patch_size(fwinfo);
- patch_buf = (void *)CsrMemAlloc(patch_buf_size);
+ patch_buf = kmalloc(patch_buf_size, GFP_KERNEL);
if (!patch_buf)
{
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)
for(i=0; i<size; i++)
{
priv->rxSignalBuffer.rx_buff[i].sig_len=0;
- priv->rxSignalBuffer.rx_buff[i].bufptr = CsrMemAlloc(UNIFI_PACKED_SIGBUF_SIZE);
+ priv->rxSignalBuffer.rx_buff[i].bufptr = kmalloc(UNIFI_PACKED_SIGBUF_SIZE, GFP_KERNEL);
if (priv->rxSignalBuffer.rx_buff[i].bufptr == NULL)
{
int j;