From 4fe9db37104f833972486355fe86d7dcd29279b5 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Fri, 20 Jul 2012 15:26:55 -0700 Subject: [PATCH] staging: csr: remove CsrMemFree() and CsrMemFreeDma() MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit They were just wrappers around kfree() so call that instead. Cc: Mikko Virkkilä Cc: Lauri Hintsala Cc: Riku Mettälä Cc: Veli-Pekka Peltola Signed-off-by: Greg Kroah-Hartman --- drivers/staging/csr/csr_framework_ext.c | 34 ------------------- drivers/staging/csr/csr_framework_ext.h | 29 ---------------- drivers/staging/csr/csr_wifi_hip_card_sdio.c | 34 ++++++------------- .../staging/csr/csr_wifi_hip_card_sdio_intr.c | 2 +- drivers/staging/csr/csr_wifi_hip_download.c | 15 ++++---- drivers/staging/csr/csr_wifi_hip_dump.c | 12 +++---- drivers/staging/csr/csr_wifi_hip_xbv.c | 7 ++-- drivers/staging/csr/io.c | 4 +-- 8 files changed, 30 insertions(+), 107 deletions(-) diff --git a/drivers/staging/csr/csr_framework_ext.c b/drivers/staging/csr/csr_framework_ext.c index 7a0d660007fd..22345e80467f 100644 --- a/drivers/staging/csr/csr_framework_ext.c +++ b/drivers/staging/csr/csr_framework_ext.c @@ -194,23 +194,6 @@ void *CsrMemAlloc(size_t size) } EXPORT_SYMBOL_GPL(CsrMemAlloc); -/*----------------------------------------------------------------------------* - * NAME - * CsrMemFree - * - * DESCRIPTION - * Free dynamic allocated memory. - * - * RETURNS - * void - * - *----------------------------------------------------------------------------*/ -void CsrMemFree(void *pointer) -{ - kfree(pointer); -} -EXPORT_SYMBOL_GPL(CsrMemFree); - /*----------------------------------------------------------------------------* * NAME * CsrMemAllocDma @@ -228,20 +211,3 @@ void *CsrMemAllocDma(size_t size) return kmalloc(size, GFP_KERNEL | GFP_DMA); } EXPORT_SYMBOL_GPL(CsrMemAllocDma); - -/*----------------------------------------------------------------------------* - * NAME - * CsrMemFreeDma - * - * DESCRIPTION - * Free DMA capable dynamic allocated memory. - * - * RETURNS - * void - * - *----------------------------------------------------------------------------*/ -void CsrMemFreeDma(void *pointer) -{ - kfree(pointer); -} -EXPORT_SYMBOL_GPL(CsrMemFreeDma); diff --git a/drivers/staging/csr/csr_framework_ext.h b/drivers/staging/csr/csr_framework_ext.h index 46689c173c6f..a3fc15299075 100644 --- a/drivers/staging/csr/csr_framework_ext.h +++ b/drivers/staging/csr/csr_framework_ext.h @@ -283,19 +283,6 @@ void *CsrMemCallocDebug(size_t numberOfElements, size_t elementSize, void *CsrMemCalloc(size_t numberOfElements, size_t elementSize); #endif -/*----------------------------------------------------------------------------* - * NAME - * CsrMemFree - * - * DESCRIPTION - * Free dynamic allocated memory. - * - * RETURNS - * void - * - *----------------------------------------------------------------------------*/ -void CsrMemFree(void *pointer); - /*----------------------------------------------------------------------------* * NAME * CsrMemAllocDma @@ -317,18 +304,6 @@ void *CsrMemAllocDma(size_t size); #endif -/*----------------------------------------------------------------------------* - * NAME - * CsrMemFreeDma - * - * DESCRIPTION - * Free dynamic memory allocated by CsrMemAllocDma. - * - * RETURNS - * void - * - *----------------------------------------------------------------------------*/ -void CsrMemFreeDma(void *pointer); #else #include "csr_pmem.h" @@ -337,12 +312,8 @@ void CsrMemFreeDma(void *pointer); #define CsrMemCalloc(numberOfElements, elementSize) CsrPmemDebugAlloc((numberOfElements * elementSize), CSR_PMEM_DEBUG_TYPE_MEM_CALLOC, __FILE__, __LINE__) -#define CsrMemFree(ptr) CsrPmemDebugFree(ptr,CSR_PMEM_DEBUG_TYPE_MEM_ALLOC, __FILE__, __LINE__) - #define CsrMemAllocDma(size) CsrPmemDebugAlloc(size, CSR_PMEM_DEBUG_TYPE_MEM_ALLOC_DMA, __FILE__, __LINE__) -#define CsrMemFreeDma(ptr) CsrPmemDebugFree(ptr, CSR_PMEM_DEBUG_TYPE_MEM_ALLOC_DMA, __FILE__, __LINE__) - #endif diff --git a/drivers/staging/csr/csr_wifi_hip_card_sdio.c b/drivers/staging/csr/csr_wifi_hip_card_sdio.c index 78fc5c47b614..4f2d2e3e45bb 100644 --- a/drivers/staging/csr/csr_wifi_hip_card_sdio.c +++ b/drivers/staging/csr/csr_wifi_hip_card_sdio.c @@ -21,6 +21,7 @@ * * --------------------------------------------------------------------------- */ +#include #include "csr_wifi_hip_unifi.h" #include "csr_wifi_hip_conversions.h" #include "csr_wifi_hip_unifiversion.h" @@ -1793,37 +1794,22 @@ static void card_free_memory_resources(card_t *card) unifi_cancel_pending_signals(card); - if (card->to_host_data) - { - CsrMemFree(card->to_host_data); - card->to_host_data = NULL; - } + kfree(card->to_host_data); + card->to_host_data = NULL; - if (card->from_host_data) - { - CsrMemFree(card->from_host_data); - card->from_host_data = NULL; - } + kfree(card->from_host_data); + card->from_host_data = NULL; /* free the memory for slot host tag mapping array */ - if (card->fh_slot_host_tag_record) - { - CsrMemFree(card->fh_slot_host_tag_record); - card->fh_slot_host_tag_record = NULL; - } + kfree(card->fh_slot_host_tag_record); + card->fh_slot_host_tag_record = NULL; - if (card->fh_buffer.buf) - { - CsrMemFreeDma(card->fh_buffer.buf); - } + kfree(card->fh_buffer.buf); card->fh_buffer.ptr = card->fh_buffer.buf = NULL; card->fh_buffer.bufsize = 0; card->fh_buffer.count = 0; - if (card->th_buffer.buf) - { - CsrMemFreeDma(card->th_buffer.buf); - } + kfree(card->th_buffer.buf); card->th_buffer.ptr = card->th_buffer.buf = NULL; card->th_buffer.bufsize = 0; card->th_buffer.count = 0; @@ -1984,7 +1970,7 @@ void unifi_free_card(card_t *card) unifi_coredump_free(card); /* free anyway to prevent memory leak */ } - CsrMemFree(card); + kfree(card); func_exit(); } /* unifi_free_card() */ diff --git a/drivers/staging/csr/csr_wifi_hip_card_sdio_intr.c b/drivers/staging/csr/csr_wifi_hip_card_sdio_intr.c index 9fdd577bb171..9789579f1fc4 100644 --- a/drivers/staging/csr/csr_wifi_hip_card_sdio_intr.c +++ b/drivers/staging/csr/csr_wifi_hip_card_sdio_intr.c @@ -1817,7 +1817,7 @@ static CsrResult process_bulk_data_command(card_t *card, const u8 *cmdptr, /* moving this check before we clear host data slot */ if ((len != 0) && (dir == UNIFI_SDIO_WRITE) && (((ptrdiff_t)bdslot->os_data_ptr + offset) & 3)) { - CsrMemFreeDma(host_bulk_data_slot); + kfree(host_bulk_data_slot); } #endif diff --git a/drivers/staging/csr/csr_wifi_hip_download.c b/drivers/staging/csr/csr_wifi_hip_download.c index 15da98e2ca9e..1a1dfb628450 100644 --- a/drivers/staging/csr/csr_wifi_hip_download.c +++ b/drivers/staging/csr/csr_wifi_hip_download.c @@ -17,6 +17,7 @@ * * --------------------------------------------------------------------------- */ +#include #include "csr_wifi_hip_unifi.h" #include "csr_wifi_hip_unifiversion.h" #include "csr_wifi_hip_card.h" @@ -270,7 +271,7 @@ static CsrResult do_patch_convert_download(card_t *card, void *dlpriv, xbv1_t *p /* Download the patch */ unifi_info(card->ospriv, "Downloading converted f/w as patch\n"); r = unifi_dl_patch(card, desc, sym.obj); - CsrMemFree(pfw); + kfree(pfw); unifi_fw_close_buffer(card->ospriv, desc); if (r != CSR_RESULT_SUCCESS) @@ -347,7 +348,7 @@ CsrResult unifi_dl_firmware(card_t *card, void *dlpriv) { unifi_error(card->ospriv, "File type is %s, expected firmware.\n", fwinfo->mode == xbv_patch?"patch" : "unknown"); - CsrMemFree(fwinfo); + kfree(fwinfo); return CSR_WIFI_HIP_RESULT_INVALID_VALUE; } @@ -372,7 +373,7 @@ CsrResult unifi_dl_firmware(card_t *card, void *dlpriv) r = CSR_WIFI_HIP_RESULT_INVALID_VALUE; } - CsrMemFree(fwinfo); + kfree(fwinfo); func_exit_r(r); return r; } /* unifi_dl_firmware() */ @@ -426,7 +427,7 @@ CsrResult unifi_dl_patch(card_t *card, void *dlpriv, u32 boot_ctrl) r = xbv1_parse(card, unifi_fw_read, dlpriv, fwinfo); if (r != CSR_RESULT_SUCCESS || fwinfo->mode != xbv_patch) { - CsrMemFree(fwinfo); + kfree(fwinfo); unifi_error(card->ospriv, "Failed to read in patch file\n"); func_exit(); return CSR_WIFI_HIP_RESULT_INVALID_VALUE; @@ -441,7 +442,7 @@ CsrResult unifi_dl_patch(card_t *card, void *dlpriv, u32 boot_ctrl) { unifi_error(card->ospriv, "Wrong patch file for chip (chip = %lu, file = %lu)\n", card->build_id, fwinfo->build_id); - CsrMemFree(fwinfo); + kfree(fwinfo); #ifndef CSR_WIFI_IGNORE_PATCH_VERSION_MISMATCH func_exit(); return CSR_WIFI_HIP_RESULT_INVALID_VALUE; @@ -458,7 +459,7 @@ CsrResult unifi_dl_patch(card_t *card, void *dlpriv, u32 boot_ctrl) unifi_error(card->ospriv, "Failed to patch image\n"); } - CsrMemFree(fwinfo); + kfree(fwinfo); func_exit_r(r); return r; @@ -720,7 +721,7 @@ static CsrResult send_ptdl_to_unifi(card_t *card, void *dlpriv, } } - CsrMemFreeDma(buf); + kfree(buf); if (r != CSR_RESULT_SUCCESS && r != CSR_WIFI_HIP_RESULT_NO_DEVICE) { diff --git a/drivers/staging/csr/csr_wifi_hip_dump.c b/drivers/staging/csr/csr_wifi_hip_dump.c index 0d1f9df24114..350d9d204488 100644 --- a/drivers/staging/csr/csr_wifi_hip_dump.c +++ b/drivers/staging/csr/csr_wifi_hip_dump.c @@ -17,6 +17,7 @@ * * --------------------------------------------------------------------------- */ +#include #include "csr_wifi_hip_unifi.h" #include "csr_wifi_hip_unifiversion.h" #include "csr_wifi_hip_card.h" @@ -696,7 +697,7 @@ coredump_buffer* new_coredump_node(void *ospriv, coredump_buffer *prevnode) { for (i = 0; newnode->zone[i] != NULL; i++) { - CsrMemFree(newnode->zone[i]); + kfree(newnode->zone[i]); newnode->zone[i] = NULL; } } @@ -844,11 +845,8 @@ void unifi_coredump_free(card_t *card) /* Free payload zones */ for (j = 0; j < HIP_CDUMP_NUM_ZONES; j++) { - if (node->zone[j] != NULL) - { - CsrMemFree(node->zone[j]); - node->zone[j] = NULL; - } + kfree(node->zone[j]); + node->zone[j] = NULL; } /* Detach */ @@ -856,7 +854,7 @@ void unifi_coredump_free(card_t *card) node = node->next; /* Free header */ - CsrMemFree(del_node); + kfree(del_node); i++; } while ((node != NULL) && (node != card->dump_buf)); diff --git a/drivers/staging/csr/csr_wifi_hip_xbv.c b/drivers/staging/csr/csr_wifi_hip_xbv.c index c503365581ff..3016e63e212c 100644 --- a/drivers/staging/csr/csr_wifi_hip_xbv.c +++ b/drivers/staging/csr/csr_wifi_hip_xbv.c @@ -19,6 +19,7 @@ * * --------------------------------------------------------------------------- */ +#include #ifdef CSR_WIFI_XBV_TEST /* Standalone test harness */ @@ -959,7 +960,7 @@ s32 xbv1_read_slut(card_t *card, fwreadfn_t readfn, void *dlpriv, xbv1_t *fwinfo * * Returns: * Pointer to firmware image, or NULL on error. Caller must free this - * buffer via CsrMemFree() once it's finished with. + * buffer via kfree() once it's finished with. * * Notes: * The input fw_buf should have been checked via xbv1_parse prior to @@ -1021,7 +1022,7 @@ void* xbv_to_patch(card_t *card, fwreadfn_t readfn, patch_buf = (void *)CsrMemAlloc(patch_buf_size); if (!patch_buf) { - CsrMemFree(rdbuf); + kfree(rdbuf); unifi_error(NULL, "Can't malloc buffer for patch conversion\n"); return NULL; } @@ -1067,7 +1068,7 @@ void* xbv_to_patch(card_t *card, fwreadfn_t readfn, { *size = patch_offs; } - CsrMemFree(rdbuf); + kfree(rdbuf); return patch_buf; } diff --git a/drivers/staging/csr/io.c b/drivers/staging/csr/io.c index 65b8895a8a87..38b5f7ee6486 100644 --- a/drivers/staging/csr/io.c +++ b/drivers/staging/csr/io.c @@ -107,7 +107,7 @@ static CsrResult signal_buffer_init(unifi_priv_t * priv, int size) for(j=0;jrxSignalBuffer.rx_buff[j].sig_len=0; - CsrMemFree(priv->rxSignalBuffer.rx_buff[j].bufptr); + kfree(priv->rxSignalBuffer.rx_buff[j].bufptr); priv->rxSignalBuffer.rx_buff[j].bufptr = NULL; } func_exit(); @@ -126,7 +126,7 @@ static void signal_buffer_free(unifi_priv_t * priv, int size) for(i=0; irxSignalBuffer.rx_buff[i].sig_len=0; - CsrMemFree(priv->rxSignalBuffer.rx_buff[i].bufptr); + kfree(priv->rxSignalBuffer.rx_buff[i].bufptr); priv->rxSignalBuffer.rx_buff[i].bufptr = NULL; } } -- 2.39.5