Commit 4fe9db37 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

staging: csr: remove CsrMemFree() and CsrMemFreeDma()

They were just wrappers around kfree() so call that instead.

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: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent d63123fc
...@@ -194,23 +194,6 @@ void *CsrMemAlloc(size_t size) ...@@ -194,23 +194,6 @@ void *CsrMemAlloc(size_t size)
} }
EXPORT_SYMBOL_GPL(CsrMemAlloc); EXPORT_SYMBOL_GPL(CsrMemAlloc);
/*----------------------------------------------------------------------------*
* NAME
* CsrMemFree
*
* DESCRIPTION
* Free dynamic allocated memory.
*
* RETURNS
* void
*
*----------------------------------------------------------------------------*/
void CsrMemFree(void *pointer)
{
kfree(pointer);
}
EXPORT_SYMBOL_GPL(CsrMemFree);
/*----------------------------------------------------------------------------* /*----------------------------------------------------------------------------*
* NAME * NAME
* CsrMemAllocDma * CsrMemAllocDma
...@@ -228,20 +211,3 @@ void *CsrMemAllocDma(size_t size) ...@@ -228,20 +211,3 @@ void *CsrMemAllocDma(size_t size)
return kmalloc(size, GFP_KERNEL | GFP_DMA); return kmalloc(size, GFP_KERNEL | GFP_DMA);
} }
EXPORT_SYMBOL_GPL(CsrMemAllocDma); 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);
...@@ -283,19 +283,6 @@ void *CsrMemCallocDebug(size_t numberOfElements, size_t elementSize, ...@@ -283,19 +283,6 @@ void *CsrMemCallocDebug(size_t numberOfElements, size_t elementSize,
void *CsrMemCalloc(size_t numberOfElements, size_t elementSize); void *CsrMemCalloc(size_t numberOfElements, size_t elementSize);
#endif #endif
/*----------------------------------------------------------------------------*
* NAME
* CsrMemFree
*
* DESCRIPTION
* Free dynamic allocated memory.
*
* RETURNS
* void
*
*----------------------------------------------------------------------------*/
void CsrMemFree(void *pointer);
/*----------------------------------------------------------------------------* /*----------------------------------------------------------------------------*
* NAME * NAME
* CsrMemAllocDma * CsrMemAllocDma
...@@ -317,18 +304,6 @@ void *CsrMemAllocDma(size_t size); ...@@ -317,18 +304,6 @@ void *CsrMemAllocDma(size_t size);
#endif #endif
/*----------------------------------------------------------------------------*
* NAME
* CsrMemFreeDma
*
* DESCRIPTION
* Free dynamic memory allocated by CsrMemAllocDma.
*
* RETURNS
* void
*
*----------------------------------------------------------------------------*/
void CsrMemFreeDma(void *pointer);
#else #else
#include "csr_pmem.h" #include "csr_pmem.h"
...@@ -337,12 +312,8 @@ void CsrMemFreeDma(void *pointer); ...@@ -337,12 +312,8 @@ void CsrMemFreeDma(void *pointer);
#define CsrMemCalloc(numberOfElements, elementSize) CsrPmemDebugAlloc((numberOfElements * elementSize), CSR_PMEM_DEBUG_TYPE_MEM_CALLOC, __FILE__, __LINE__) #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 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 #endif
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
* *
* --------------------------------------------------------------------------- * ---------------------------------------------------------------------------
*/ */
#include <linux/slab.h>
#include "csr_wifi_hip_unifi.h" #include "csr_wifi_hip_unifi.h"
#include "csr_wifi_hip_conversions.h" #include "csr_wifi_hip_conversions.h"
#include "csr_wifi_hip_unifiversion.h" #include "csr_wifi_hip_unifiversion.h"
...@@ -1793,37 +1794,22 @@ static void card_free_memory_resources(card_t *card) ...@@ -1793,37 +1794,22 @@ static void card_free_memory_resources(card_t *card)
unifi_cancel_pending_signals(card); unifi_cancel_pending_signals(card);
if (card->to_host_data) kfree(card->to_host_data);
{
CsrMemFree(card->to_host_data);
card->to_host_data = NULL; card->to_host_data = NULL;
}
if (card->from_host_data) kfree(card->from_host_data);
{
CsrMemFree(card->from_host_data);
card->from_host_data = NULL; card->from_host_data = NULL;
}
/* free the memory for slot host tag mapping array */ /* free the memory for slot host tag mapping array */
if (card->fh_slot_host_tag_record) kfree(card->fh_slot_host_tag_record);
{
CsrMemFree(card->fh_slot_host_tag_record);
card->fh_slot_host_tag_record = NULL; card->fh_slot_host_tag_record = NULL;
}
if (card->fh_buffer.buf) kfree(card->fh_buffer.buf);
{
CsrMemFreeDma(card->fh_buffer.buf);
}
card->fh_buffer.ptr = card->fh_buffer.buf = NULL; card->fh_buffer.ptr = card->fh_buffer.buf = NULL;
card->fh_buffer.bufsize = 0; card->fh_buffer.bufsize = 0;
card->fh_buffer.count = 0; card->fh_buffer.count = 0;
if (card->th_buffer.buf) kfree(card->th_buffer.buf);
{
CsrMemFreeDma(card->th_buffer.buf);
}
card->th_buffer.ptr = card->th_buffer.buf = NULL; card->th_buffer.ptr = card->th_buffer.buf = NULL;
card->th_buffer.bufsize = 0; card->th_buffer.bufsize = 0;
card->th_buffer.count = 0; card->th_buffer.count = 0;
...@@ -1984,7 +1970,7 @@ void unifi_free_card(card_t *card) ...@@ -1984,7 +1970,7 @@ void unifi_free_card(card_t *card)
unifi_coredump_free(card); /* free anyway to prevent memory leak */ unifi_coredump_free(card); /* free anyway to prevent memory leak */
} }
CsrMemFree(card); kfree(card);
func_exit(); func_exit();
} /* unifi_free_card() */ } /* unifi_free_card() */
......
...@@ -1817,7 +1817,7 @@ static CsrResult process_bulk_data_command(card_t *card, const u8 *cmdptr, ...@@ -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 */ /* moving this check before we clear host data slot */
if ((len != 0) && (dir == UNIFI_SDIO_WRITE) && (((ptrdiff_t)bdslot->os_data_ptr + offset) & 3)) 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 #endif
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
* *
* --------------------------------------------------------------------------- * ---------------------------------------------------------------------------
*/ */
#include <linux/slab.h>
#include "csr_wifi_hip_unifi.h" #include "csr_wifi_hip_unifi.h"
#include "csr_wifi_hip_unifiversion.h" #include "csr_wifi_hip_unifiversion.h"
#include "csr_wifi_hip_card.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 ...@@ -270,7 +271,7 @@ static CsrResult do_patch_convert_download(card_t *card, void *dlpriv, xbv1_t *p
/* Download the patch */ /* Download the patch */
unifi_info(card->ospriv, "Downloading converted f/w as patch\n"); unifi_info(card->ospriv, "Downloading converted f/w as patch\n");
r = unifi_dl_patch(card, desc, sym.obj); r = unifi_dl_patch(card, desc, sym.obj);
CsrMemFree(pfw); kfree(pfw);
unifi_fw_close_buffer(card->ospriv, desc); unifi_fw_close_buffer(card->ospriv, desc);
if (r != CSR_RESULT_SUCCESS) if (r != CSR_RESULT_SUCCESS)
...@@ -347,7 +348,7 @@ CsrResult unifi_dl_firmware(card_t *card, void *dlpriv) ...@@ -347,7 +348,7 @@ CsrResult unifi_dl_firmware(card_t *card, void *dlpriv)
{ {
unifi_error(card->ospriv, "File type is %s, expected firmware.\n", unifi_error(card->ospriv, "File type is %s, expected firmware.\n",
fwinfo->mode == xbv_patch?"patch" : "unknown"); fwinfo->mode == xbv_patch?"patch" : "unknown");
CsrMemFree(fwinfo); kfree(fwinfo);
return CSR_WIFI_HIP_RESULT_INVALID_VALUE; return CSR_WIFI_HIP_RESULT_INVALID_VALUE;
} }
...@@ -372,7 +373,7 @@ CsrResult unifi_dl_firmware(card_t *card, void *dlpriv) ...@@ -372,7 +373,7 @@ CsrResult unifi_dl_firmware(card_t *card, void *dlpriv)
r = CSR_WIFI_HIP_RESULT_INVALID_VALUE; r = CSR_WIFI_HIP_RESULT_INVALID_VALUE;
} }
CsrMemFree(fwinfo); kfree(fwinfo);
func_exit_r(r); func_exit_r(r);
return r; return r;
} /* unifi_dl_firmware() */ } /* unifi_dl_firmware() */
...@@ -426,7 +427,7 @@ CsrResult unifi_dl_patch(card_t *card, void *dlpriv, u32 boot_ctrl) ...@@ -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); r = xbv1_parse(card, unifi_fw_read, dlpriv, fwinfo);
if (r != CSR_RESULT_SUCCESS || fwinfo->mode != xbv_patch) if (r != CSR_RESULT_SUCCESS || fwinfo->mode != xbv_patch)
{ {
CsrMemFree(fwinfo); kfree(fwinfo);
unifi_error(card->ospriv, "Failed to read in patch file\n"); unifi_error(card->ospriv, "Failed to read in patch file\n");
func_exit(); func_exit();
return CSR_WIFI_HIP_RESULT_INVALID_VALUE; return CSR_WIFI_HIP_RESULT_INVALID_VALUE;
...@@ -441,7 +442,7 @@ CsrResult unifi_dl_patch(card_t *card, void *dlpriv, u32 boot_ctrl) ...@@ -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", unifi_error(card->ospriv, "Wrong patch file for chip (chip = %lu, file = %lu)\n",
card->build_id, fwinfo->build_id); card->build_id, fwinfo->build_id);
CsrMemFree(fwinfo); kfree(fwinfo);
#ifndef CSR_WIFI_IGNORE_PATCH_VERSION_MISMATCH #ifndef CSR_WIFI_IGNORE_PATCH_VERSION_MISMATCH
func_exit(); func_exit();
return CSR_WIFI_HIP_RESULT_INVALID_VALUE; return CSR_WIFI_HIP_RESULT_INVALID_VALUE;
...@@ -458,7 +459,7 @@ CsrResult unifi_dl_patch(card_t *card, void *dlpriv, u32 boot_ctrl) ...@@ -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"); unifi_error(card->ospriv, "Failed to patch image\n");
} }
CsrMemFree(fwinfo); kfree(fwinfo);
func_exit_r(r); func_exit_r(r);
return r; return r;
...@@ -720,7 +721,7 @@ static CsrResult send_ptdl_to_unifi(card_t *card, void *dlpriv, ...@@ -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) if (r != CSR_RESULT_SUCCESS && r != CSR_WIFI_HIP_RESULT_NO_DEVICE)
{ {
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
* *
* --------------------------------------------------------------------------- * ---------------------------------------------------------------------------
*/ */
#include <linux/slab.h>
#include "csr_wifi_hip_unifi.h" #include "csr_wifi_hip_unifi.h"
#include "csr_wifi_hip_unifiversion.h" #include "csr_wifi_hip_unifiversion.h"
#include "csr_wifi_hip_card.h" #include "csr_wifi_hip_card.h"
...@@ -696,7 +697,7 @@ coredump_buffer* new_coredump_node(void *ospriv, coredump_buffer *prevnode) ...@@ -696,7 +697,7 @@ coredump_buffer* new_coredump_node(void *ospriv, coredump_buffer *prevnode)
{ {
for (i = 0; newnode->zone[i] != NULL; i++) for (i = 0; newnode->zone[i] != NULL; i++)
{ {
CsrMemFree(newnode->zone[i]); kfree(newnode->zone[i]);
newnode->zone[i] = NULL; newnode->zone[i] = NULL;
} }
} }
...@@ -844,19 +845,16 @@ void unifi_coredump_free(card_t *card) ...@@ -844,19 +845,16 @@ void unifi_coredump_free(card_t *card)
/* Free payload zones */ /* Free payload zones */
for (j = 0; j < HIP_CDUMP_NUM_ZONES; j++) for (j = 0; j < HIP_CDUMP_NUM_ZONES; j++)
{ {
if (node->zone[j] != NULL) kfree(node->zone[j]);
{
CsrMemFree(node->zone[j]);
node->zone[j] = NULL; node->zone[j] = NULL;
} }
}
/* Detach */ /* Detach */
del_node = node; del_node = node;
node = node->next; node = node->next;
/* Free header */ /* Free header */
CsrMemFree(del_node); kfree(del_node);
i++; i++;
} while ((node != NULL) && (node != card->dump_buf)); } while ((node != NULL) && (node != card->dump_buf));
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
* *
* --------------------------------------------------------------------------- * ---------------------------------------------------------------------------
*/ */
#include <linux/slab.h>
#ifdef CSR_WIFI_XBV_TEST #ifdef CSR_WIFI_XBV_TEST
/* Standalone test harness */ /* Standalone test harness */
...@@ -959,7 +960,7 @@ s32 xbv1_read_slut(card_t *card, fwreadfn_t readfn, void *dlpriv, xbv1_t *fwinfo ...@@ -959,7 +960,7 @@ s32 xbv1_read_slut(card_t *card, fwreadfn_t readfn, void *dlpriv, xbv1_t *fwinfo
* *
* Returns: * Returns:
* Pointer to firmware image, or NULL on error. Caller must free this * 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: * Notes:
* The input fw_buf should have been checked via xbv1_parse prior to * 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, ...@@ -1021,7 +1022,7 @@ void* xbv_to_patch(card_t *card, fwreadfn_t readfn,
patch_buf = (void *)CsrMemAlloc(patch_buf_size); patch_buf = (void *)CsrMemAlloc(patch_buf_size);
if (!patch_buf) if (!patch_buf)
{ {
CsrMemFree(rdbuf); kfree(rdbuf);
unifi_error(NULL, "Can't malloc buffer for patch conversion\n"); unifi_error(NULL, "Can't malloc buffer for patch conversion\n");
return NULL; return NULL;
} }
...@@ -1067,7 +1068,7 @@ void* xbv_to_patch(card_t *card, fwreadfn_t readfn, ...@@ -1067,7 +1068,7 @@ void* xbv_to_patch(card_t *card, fwreadfn_t readfn,
{ {
*size = patch_offs; *size = patch_offs;
} }
CsrMemFree(rdbuf); kfree(rdbuf);
return patch_buf; return patch_buf;
} }
......
...@@ -107,7 +107,7 @@ static CsrResult signal_buffer_init(unifi_priv_t * priv, int size) ...@@ -107,7 +107,7 @@ static CsrResult signal_buffer_init(unifi_priv_t * priv, int size)
for(j=0;j<i;j++) for(j=0;j<i;j++)
{ {
priv->rxSignalBuffer.rx_buff[j].sig_len=0; priv->rxSignalBuffer.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; priv->rxSignalBuffer.rx_buff[j].bufptr = NULL;
} }
func_exit(); func_exit();
...@@ -126,7 +126,7 @@ static void signal_buffer_free(unifi_priv_t * priv, int size) ...@@ -126,7 +126,7 @@ static void signal_buffer_free(unifi_priv_t * priv, int size)
for(i=0; i<size; i++) for(i=0; i<size; i++)
{ {
priv->rxSignalBuffer.rx_buff[i].sig_len=0; priv->rxSignalBuffer.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; priv->rxSignalBuffer.rx_buff[i].bufptr = NULL;
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment