diff options
author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-07-20 16:41:09 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-07-20 16:41:09 -0700 |
commit | 786eeeb3756e7fb08174c3a136c16462ccd541d1 (patch) | |
tree | 9b7621b4448768f8f950e80a1bba468652608f1c /drivers/staging | |
parent | 55a27055b9ea5aabf8206ed6b7777c79f4e840c3 (diff) |
staging: csr: remove CsrPmemAlloc
It's just a wrapper around kmalloc(, GFP_KERNEL) + a call to panic() if
we are out of memory, which is a very foolish thing to do (the panic
that is.)
So replace it with calls to kmalloc() and ignore the out-of-memory
casese for now, odds are it will not be hit, and if it does, hey, we
will end up panicing just the same as with the old code.
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')
26 files changed, 534 insertions, 605 deletions
diff --git a/drivers/staging/csr/Makefile b/drivers/staging/csr/Makefile index f4a8950bfae..814f57a539d 100644 --- a/drivers/staging/csr/Makefile +++ b/drivers/staging/csr/Makefile @@ -69,7 +69,6 @@ csr_wifi-y := bh.o \ csr_helper-y := csr_time.o \ csr_util.o \ csr_framework_ext.o \ - csr_pmem.o \ csr_wifi_serialize_primitive_types.o \ csr_serialize_primitive_types.o \ csr_utf16.o \ diff --git a/drivers/staging/csr/csr_msgconv.c b/drivers/staging/csr/csr_msgconv.c index 42e0a4aef0a..dbf0d64a206 100644 --- a/drivers/staging/csr/csr_msgconv.c +++ b/drivers/staging/csr/csr_msgconv.c @@ -233,7 +233,7 @@ void CsrMsgConvInsert(u16 primType, const CsrMsgConvMsgEntry *ce) } else { - pc = CsrPmemAlloc(sizeof(*pc)); + pc = kmalloc(sizeof(*pc), GFP_KERNEL); pc->primType = primType; pc->conv = ce; pc->lookupFunc = NULL; @@ -279,7 +279,7 @@ CsrMsgConvEntry *CsrMsgConvInit(void) { if (!converter) { - converter = (CsrMsgConvEntry *) CsrPmemAlloc(sizeof(CsrMsgConvEntry)); + converter = kmalloc(sizeof(CsrMsgConvEntry), GFP_KERNEL); converter->profile_converters = NULL; converter->free_message = free_message; diff --git a/drivers/staging/csr/csr_pmem.c b/drivers/staging/csr/csr_pmem.c deleted file mode 100644 index a2779256005..00000000000 --- a/drivers/staging/csr/csr_pmem.c +++ /dev/null @@ -1,40 +0,0 @@ -/***************************************************************************** - - (c) Cambridge Silicon Radio Limited 2010 - All rights reserved and confidential information of CSR - - Refer to LICENSE.txt included with this source for details - on the license terms. - -*****************************************************************************/ - -#include <linux/kernel.h> -#include <linux/version.h> -#include <linux/module.h> - - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 33) -#include <linux/autoconf.h> -#elif LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 16) -#include <linux/config.h> -#endif - -#include <linux/slab.h> - -#include "csr_panic.h" -#include "csr_pmem.h" - -void *CsrPmemAlloc(size_t size) -{ - void *ret; - - ret = kmalloc(size, GFP_KERNEL); - if (!ret) - { - CsrPanic(CSR_TECH_FW, CSR_PANIC_FW_HEAP_EXHAUSTION, - "out of memory"); - } - - return ret; -} -EXPORT_SYMBOL_GPL(CsrPmemAlloc); diff --git a/drivers/staging/csr/csr_pmem.h b/drivers/staging/csr/csr_pmem.h index 283aff09d86..1fb74fa0d1c 100644 --- a/drivers/staging/csr/csr_pmem.h +++ b/drivers/staging/csr/csr_pmem.h @@ -17,36 +17,6 @@ extern "C" { #endif -#ifndef CSR_PMEM_DEBUG_ENABLE -/***************************************************************************** - - NAME - CsrPmemAlloc - - DESCRIPTION - This function will allocate a contiguous block of memory of at least - the specified size in bytes and return a pointer to the allocated - memory. This function is not allowed to return NULL. A size of 0 is a - valid request, and a unique and valid (not NULL) pointer must be - returned in this case. - - PARAMETERS - size - Size of memory requested. Note that a size of 0 is valid. - - RETURNS - Pointer to allocated memory. - -*****************************************************************************/ -#ifdef CSR_PMEM_DEBUG -void *CsrPmemAllocDebug(size_t size, - const char *file, u32 line); -#define CsrPmemAlloc(sz) CsrPmemAllocDebug((sz), __FILE__, __LINE__) -#else -void *CsrPmemAlloc(size_t size); -#endif - -#endif - /***************************************************************************** NAME @@ -114,7 +84,6 @@ typedef void (CsrPmemDebugOnFree)(void *ptr, void *userptr, CsrPmemDebugAllocTyp void CsrPmemDebugInstallHooks(u8 headSize, u8 endSize, CsrPmemDebugOnAlloc *onAllocCallback, CsrPmemDebugOnFree *onFreeCallback); void *CsrPmemDebugAlloc(size_t size, CsrPmemDebugAllocType type, const char* file, u32 line); -#define CsrPmemAlloc(size) CsrPmemDebugAlloc(size, CSR_PMEM_DEBUG_TYPE_PMEM_ALLOC, __FILE__, __LINE__) void CsrPmemDebugFree(void *ptr, CsrPmemDebugAllocType type, const char* file, u32 line); diff --git a/drivers/staging/csr/csr_sched.h b/drivers/staging/csr/csr_sched.h index 7ae1ea5b322..cc1b8bf6607 100644 --- a/drivers/staging/csr/csr_sched.h +++ b/drivers/staging/csr/csr_sched.h @@ -120,9 +120,9 @@ void CsrSchedBgintSet(CsrSchedBgint bgint); * be null. * * NOTE - * If "mv" is not null then it will typically be a chunk of CsrPmemAlloc()ed + * If "mv" is not null then it will typically be a chunk of kmalloc()ed * memory, though there is no need for it to be so. Tasks should normally - * obey the convention that when a message built with CsrPmemAlloc()ed memory + * obey the convention that when a message built with kmalloc()ed memory * is given to CsrSchedMessagePut() then ownership of the memory is ceded to the * scheduler - and eventually to the recipient task. I.e., the receiver of * the message will be expected to kfree() the message storage. diff --git a/drivers/staging/csr/csr_serialize_primitive_types.c b/drivers/staging/csr/csr_serialize_primitive_types.c index a4b56323a04..bb08f1952bf 100644 --- a/drivers/staging/csr/csr_serialize_primitive_types.c +++ b/drivers/staging/csr/csr_serialize_primitive_types.c @@ -9,6 +9,7 @@ *****************************************************************************/ #include <linux/module.h> +#include <linux/slab.h> #include "csr_prim_defs.h" #include "csr_msgconv.h" #include "csr_macro.h" @@ -66,7 +67,7 @@ void CsrUtf16StringDes(u16 **value, u8 *buffer, size_t *offset) CsrUint32Des(&length, buffer, offset); - *value = CsrPmemAlloc(length * sizeof(**value)); + *value = kmalloc(length * sizeof(**value), GFP_KERNEL); for (i = 0; i < length; i++) { CsrUint16Des(&(*value)[i], buffer, offset); @@ -224,7 +225,7 @@ u8 *CsrEventSer(u8 *ptr, size_t *len, void *msg) void *CsrEventDes(u8 *buffer, size_t length) { - CsrEvent *primitive = (CsrEvent *) CsrPmemAlloc(sizeof(CsrEvent)); + CsrEvent *primitive = kmalloc(sizeof(CsrEvent), GFP_KERNEL); size_t offset = 0; CsrUint16Des(&primitive->type, buffer, &offset); @@ -247,7 +248,7 @@ u8 *CsrEventCsrUint8Ser(u8 *ptr, size_t *len, void *msg) void *CsrEventCsrUint8Des(u8 *buffer, size_t length) { - CsrEventCsrUint8 *primitive = (CsrEventCsrUint8 *) CsrPmemAlloc(sizeof(CsrEventCsrUint8)); + CsrEventCsrUint8 *primitive = kmalloc(sizeof(CsrEventCsrUint8), GFP_KERNEL); size_t offset = 0; CsrUint16Des(&primitive->type, buffer, &offset); @@ -272,7 +273,7 @@ u8 *CsrEventCsrUint16Ser(u8 *ptr, size_t *len, void *msg) void *CsrEventCsrUint16Des(u8 *buffer, size_t length) { - CsrEventCsrUint16 *primitive = (CsrEventCsrUint16 *) CsrPmemAlloc(sizeof(CsrEventCsrUint16)); + CsrEventCsrUint16 *primitive = kmalloc(sizeof(CsrEventCsrUint16), GFP_KERNEL); size_t offset = 0; CsrUint16Des(&primitive->type, buffer, &offset); @@ -297,7 +298,7 @@ u8 *CsrEventCsrUint32Ser(u8 *ptr, size_t *len, void *msg) void *CsrEventCsrUint32Des(u8 *buffer, size_t length) { - CsrEventCsrUint32 *primitive = (CsrEventCsrUint32 *) CsrPmemAlloc(sizeof(CsrEventCsrUint32)); + CsrEventCsrUint32 *primitive = kmalloc(sizeof(CsrEventCsrUint32), GFP_KERNEL); size_t offset = 0; CsrUint16Des(&primitive->type, buffer, &offset); @@ -323,7 +324,7 @@ u8 *CsrEventCsrUint16CsrUint8Ser(u8 *ptr, size_t *len, void *msg) void *CsrEventCsrUint16CsrUint8Des(u8 *buffer, size_t length) { - CsrEventCsrUint16CsrUint8 *primitive = (CsrEventCsrUint16CsrUint8 *) CsrPmemAlloc(sizeof(CsrEventCsrUint16CsrUint8)); + CsrEventCsrUint16CsrUint8 *primitive = kmalloc(sizeof(CsrEventCsrUint16CsrUint8), GFP_KERNEL); size_t offset = 0; CsrUint16Des(&primitive->type, buffer, &offset); @@ -350,7 +351,7 @@ u8 *CsrEventCsrUint16CsrUint16Ser(u8 *ptr, size_t *len, void *msg) void *CsrEventCsrUint16CsrUint16Des(u8 *buffer, size_t length) { - CsrEventCsrUint16CsrUint16 *primitive = (CsrEventCsrUint16CsrUint16 *) CsrPmemAlloc(sizeof(CsrEventCsrUint16CsrUint16)); + CsrEventCsrUint16CsrUint16 *primitive = kmalloc(sizeof(CsrEventCsrUint16CsrUint16), GFP_KERNEL); size_t offset = 0; CsrUint16Des(&primitive->type, buffer, &offset); @@ -377,7 +378,7 @@ u8 *CsrEventCsrUint16CsrUint32Ser(u8 *ptr, size_t *len, void *msg) void *CsrEventCsrUint16CsrUint32Des(u8 *buffer, size_t length) { - CsrEventCsrUint16CsrUint32 *primitive = (CsrEventCsrUint16CsrUint32 *) CsrPmemAlloc(sizeof(CsrEventCsrUint16CsrUint32)); + CsrEventCsrUint16CsrUint32 *primitive = kmalloc(sizeof(CsrEventCsrUint16CsrUint32), GFP_KERNEL); size_t offset = 0; CsrUint16Des(&primitive->type, buffer, &offset); @@ -405,7 +406,7 @@ u8 *CsrEventCsrUint16CsrCharStringSer(u8 *ptr, size_t *len, void *msg) void *CsrEventCsrUint16CsrCharStringDes(u8 *buffer, size_t length) { - CsrEventCsrUint16CsrCharString *primitive = (CsrEventCsrUint16CsrCharString *) CsrPmemAlloc(sizeof(CsrEventCsrUint16CsrCharString)); + CsrEventCsrUint16CsrCharString *primitive = kmalloc(sizeof(CsrEventCsrUint16CsrCharString), GFP_KERNEL); size_t offset = 0; CsrUint16Des(&primitive->type, buffer, &offset); @@ -432,7 +433,7 @@ u8 *CsrEventCsrUint32CsrUint16Ser(u8 *ptr, size_t *len, void *msg) void *CsrEventCsrUint32CsrUint16Des(u8 *buffer, size_t length) { - CsrEventCsrUint32CsrUint16 *primitive = (CsrEventCsrUint32CsrUint16 *) CsrPmemAlloc(sizeof(CsrEventCsrUint32CsrUint16)); + CsrEventCsrUint32CsrUint16 *primitive = kmalloc(sizeof(CsrEventCsrUint32CsrUint16), GFP_KERNEL); size_t offset = 0; CsrUint16Des(&primitive->type, buffer, &offset); @@ -460,7 +461,7 @@ u8 *CsrEventCsrUint32CsrCharStringSer(u8 *ptr, size_t *len, void *msg) void *CsrEventCsrUint32CsrCharStringDes(u8 *buffer, size_t length) { - CsrEventCsrUint32CsrCharString *primitive = (CsrEventCsrUint32CsrCharString *) CsrPmemAlloc(sizeof(CsrEventCsrUint32CsrCharString)); + CsrEventCsrUint32CsrCharString *primitive = kmalloc(sizeof(CsrEventCsrUint32CsrCharString), GFP_KERNEL); size_t offset = 0; CsrUint16Des(&primitive->type, buffer, &offset); diff --git a/drivers/staging/csr/csr_utf16.c b/drivers/staging/csr/csr_utf16.c index f827342b148..801d8a8c095 100644 --- a/drivers/staging/csr/csr_utf16.c +++ b/drivers/staging/csr/csr_utf16.c @@ -88,7 +88,7 @@ u16 *CsrUint32ToUtf16String(u32 number) noOfDigits++; } - output = (u16 *) CsrPmemAlloc(sizeof(u16) * (noOfDigits + 1)); /*add space for 0-termination*/ + output = kmalloc(sizeof(u16) * (noOfDigits + 1), GFP_KERNEL); /*add space for 0-termination*/ tempNumber = number; for (count = noOfDigits; count > 0; count--) @@ -185,7 +185,7 @@ u16 *CsrUtf16ConcatenateTexts(const u16 *inputText1, const u16 *inputText2, return NULL; } - outputText = (u16 *) CsrPmemAlloc((textLen + 1) * sizeof(u16)); /* add space for 0-termination*/ + outputText = kmalloc((textLen + 1) * sizeof(u16), GFP_KERNEL); /* add space for 0-termination*/ if (inputText1 != NULL) @@ -320,7 +320,7 @@ u8 *CsrUtf16String2Utf8(const u16 *source) } } - dest = CsrPmemAlloc(length); + dest = kmalloc(length, GFP_KERNEL); destStart = dest; for (i = 0; i < sourceLength; i++) @@ -610,7 +610,7 @@ u16 *CsrUtf82Utf16String(const u8 *utf8String) } /* Create space for the null terminated character */ - dest = (u16 *) CsrPmemAlloc((1 + length) * sizeof(u16)); + dest = kmalloc((1 + length) * sizeof(u16), GFP_KERNEL); destStart = dest; for (i = 0; i < sourceLength; i++) @@ -736,7 +736,7 @@ u16 *CsrUtf16StringDuplicate(const u16 *source) if (source) /* if source is not NULL*/ { length = (CsrUtf16StrLen(source) + 1) * sizeof(u16); - target = (u16 *) CsrPmemAlloc(length); + target = kmalloc(length, GFP_KERNEL); memcpy(target, source, length); } return target; @@ -844,7 +844,7 @@ u16 *CsrUtf16String2XML(u16 *str) if (encodeChars) { - resultString = outputString = CsrPmemAlloc(stringLength * sizeof(u16)); + resultString = outputString = kmalloc(stringLength * sizeof(u16), GFP_KERNEL); scanString = str; @@ -958,7 +958,7 @@ u16 *CsrXML2Utf16String(u16 *str) if (encodeChars) { - resultString = outputString = CsrPmemAlloc(stringLength * sizeof(u16)); + resultString = outputString = kmalloc(stringLength * sizeof(u16), GFP_KERNEL); scanString = str; diff --git a/drivers/staging/csr/csr_wifi_fsm.h b/drivers/staging/csr/csr_wifi_fsm.h index 83a9c9e2297..e933ab1be43 100644 --- a/drivers/staging/csr/csr_wifi_fsm.h +++ b/drivers/staging/csr/csr_wifi_fsm.h @@ -160,7 +160,7 @@ extern void CsrWifiFsmSendEventExternal(CsrWifiFsmContext *context, CsrWifiFsmEv */ #define CsrWifiFsmSendAlienEventExternal(_context, _alienEvent, _source, _destination, _primtype, _id) \ { \ - CsrWifiFsmAlienEvent *_evt = (CsrWifiFsmAlienEvent *)CsrPmemAlloc(sizeof(CsrWifiFsmAlienEvent)); \ + CsrWifiFsmAlienEvent *_evt = kmalloc(sizeof(CsrWifiFsmAlienEvent), GFP_KERNEL); \ _evt->alienEvent = _alienEvent; \ CsrWifiFsmSendEventExternal(_context, (CsrWifiFsmEvent *)_evt, _source, _destination, _primtype, _id); \ } diff --git a/drivers/staging/csr/csr_wifi_hip_card_sdio.c b/drivers/staging/csr/csr_wifi_hip_card_sdio.c index d4c92814c65..44ab00c53fe 100644 --- a/drivers/staging/csr/csr_wifi_hip_card_sdio.c +++ b/drivers/staging/csr/csr_wifi_hip_card_sdio.c @@ -1655,7 +1655,7 @@ static CsrResult card_allocate_memory_resources(card_t *card) /* * Allocate memory for the from-host and to-host bulk data slots. - * This is done as separate CsrPmemAllocs because lots of smaller + * This is done as separate kmallocs because lots of smaller * allocations are more likely to succeed than one huge one. */ diff --git a/drivers/staging/csr/csr_wifi_nme_ap_lib.h b/drivers/staging/csr/csr_wifi_nme_ap_lib.h index 45b8d267dd0..fed0ea2c033 100644 --- a/drivers/staging/csr/csr_wifi_nme_ap_lib.h +++ b/drivers/staging/csr/csr_wifi_nme_ap_lib.h @@ -95,7 +95,7 @@ extern const char *CsrWifiNmeApDownstreamPrimNames[CSR_WIFI_NME_AP_PRIM_DOWNSTRE *******************************************************************************/ #define CsrWifiNmeApConfigSetReqCreate(msg__, dst__, src__, apConfig__, apMacConfig__) \ - msg__ = (CsrWifiNmeApConfigSetReq *) CsrPmemAlloc(sizeof(CsrWifiNmeApConfigSetReq)); \ + msg__ = kmalloc(sizeof(CsrWifiNmeApConfigSetReq), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_AP_PRIM, CSR_WIFI_NME_AP_CONFIG_SET_REQ, dst__, src__); \ msg__->apConfig = (apConfig__); \ msg__->apMacConfig = (apMacConfig__); @@ -124,7 +124,7 @@ extern const char *CsrWifiNmeApDownstreamPrimNames[CSR_WIFI_NME_AP_PRIM_DOWNSTRE *******************************************************************************/ #define CsrWifiNmeApConfigSetCfmCreate(msg__, dst__, src__, status__) \ - msg__ = (CsrWifiNmeApConfigSetCfm *) CsrPmemAlloc(sizeof(CsrWifiNmeApConfigSetCfm)); \ + msg__ = kmalloc(sizeof(CsrWifiNmeApConfigSetCfm), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_AP_PRIM, CSR_WIFI_NME_AP_CONFIG_SET_CFM, dst__, src__); \ msg__->status = (status__); @@ -159,7 +159,7 @@ extern const char *CsrWifiNmeApDownstreamPrimNames[CSR_WIFI_NME_AP_PRIM_DOWNSTRE *******************************************************************************/ #define CsrWifiNmeApStaRemoveReqCreate(msg__, dst__, src__, interfaceTag__, staMacAddress__, keepBlocking__) \ - msg__ = (CsrWifiNmeApStaRemoveReq *) CsrPmemAlloc(sizeof(CsrWifiNmeApStaRemoveReq)); \ + msg__ = kmalloc(sizeof(CsrWifiNmeApStaRemoveReq), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_AP_PRIM, CSR_WIFI_NME_AP_STA_REMOVE_REQ, dst__, src__); \ msg__->interfaceTag = (interfaceTag__); \ msg__->staMacAddress = (staMacAddress__); \ @@ -199,7 +199,7 @@ extern const char *CsrWifiNmeApDownstreamPrimNames[CSR_WIFI_NME_AP_PRIM_DOWNSTRE *******************************************************************************/ #define CsrWifiNmeApStartReqCreate(msg__, dst__, src__, interfaceTag__, apType__, cloakSsid__, ssid__, ifIndex__, channel__, apCredentials__, maxConnections__, p2pGoParam__, wpsEnabled__) \ - msg__ = (CsrWifiNmeApStartReq *) CsrPmemAlloc(sizeof(CsrWifiNmeApStartReq)); \ + msg__ = kmalloc(sizeof(CsrWifiNmeApStartReq), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_AP_PRIM, CSR_WIFI_NME_AP_START_REQ, dst__, src__); \ msg__->interfaceTag = (interfaceTag__); \ msg__->apType = (apType__); \ @@ -238,7 +238,7 @@ extern const char *CsrWifiNmeApDownstreamPrimNames[CSR_WIFI_NME_AP_PRIM_DOWNSTRE *******************************************************************************/ #define CsrWifiNmeApStartCfmCreate(msg__, dst__, src__, interfaceTag__, status__, ssid__) \ - msg__ = (CsrWifiNmeApStartCfm *) CsrPmemAlloc(sizeof(CsrWifiNmeApStartCfm)); \ + msg__ = kmalloc(sizeof(CsrWifiNmeApStartCfm), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_AP_PRIM, CSR_WIFI_NME_AP_START_CFM, dst__, src__); \ msg__->interfaceTag = (interfaceTag__); \ msg__->status = (status__); \ @@ -273,7 +273,7 @@ extern const char *CsrWifiNmeApDownstreamPrimNames[CSR_WIFI_NME_AP_PRIM_DOWNSTRE *******************************************************************************/ #define CsrWifiNmeApStationIndCreate(msg__, dst__, src__, interfaceTag__, mediaStatus__, peerMacAddress__, peerDeviceAddress__) \ - msg__ = (CsrWifiNmeApStationInd *) CsrPmemAlloc(sizeof(CsrWifiNmeApStationInd)); \ + msg__ = kmalloc(sizeof(CsrWifiNmeApStationInd), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_AP_PRIM, CSR_WIFI_NME_AP_STATION_IND, dst__, src__); \ msg__->interfaceTag = (interfaceTag__); \ msg__->mediaStatus = (mediaStatus__); \ @@ -304,7 +304,7 @@ extern const char *CsrWifiNmeApDownstreamPrimNames[CSR_WIFI_NME_AP_PRIM_DOWNSTRE *******************************************************************************/ #define CsrWifiNmeApStopReqCreate(msg__, dst__, src__, interfaceTag__) \ - msg__ = (CsrWifiNmeApStopReq *) CsrPmemAlloc(sizeof(CsrWifiNmeApStopReq)); \ + msg__ = kmalloc(sizeof(CsrWifiNmeApStopReq), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_AP_PRIM, CSR_WIFI_NME_AP_STOP_REQ, dst__, src__); \ msg__->interfaceTag = (interfaceTag__); @@ -336,7 +336,7 @@ extern const char *CsrWifiNmeApDownstreamPrimNames[CSR_WIFI_NME_AP_PRIM_DOWNSTRE *******************************************************************************/ #define CsrWifiNmeApStopIndCreate(msg__, dst__, src__, interfaceTag__, apType__, status__) \ - msg__ = (CsrWifiNmeApStopInd *) CsrPmemAlloc(sizeof(CsrWifiNmeApStopInd)); \ + msg__ = kmalloc(sizeof(CsrWifiNmeApStopInd), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_AP_PRIM, CSR_WIFI_NME_AP_STOP_IND, dst__, src__); \ msg__->interfaceTag = (interfaceTag__); \ msg__->apType = (apType__); \ @@ -369,7 +369,7 @@ extern const char *CsrWifiNmeApDownstreamPrimNames[CSR_WIFI_NME_AP_PRIM_DOWNSTRE *******************************************************************************/ #define CsrWifiNmeApStopCfmCreate(msg__, dst__, src__, interfaceTag__, status__) \ - msg__ = (CsrWifiNmeApStopCfm *) CsrPmemAlloc(sizeof(CsrWifiNmeApStopCfm)); \ + msg__ = kmalloc(sizeof(CsrWifiNmeApStopCfm), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_AP_PRIM, CSR_WIFI_NME_AP_STOP_CFM, dst__, src__); \ msg__->interfaceTag = (interfaceTag__); \ msg__->status = (status__); @@ -402,7 +402,7 @@ extern const char *CsrWifiNmeApDownstreamPrimNames[CSR_WIFI_NME_AP_PRIM_DOWNSTRE *******************************************************************************/ #define CsrWifiNmeApWmmParamUpdateReqCreate(msg__, dst__, src__, wmmApParams__, wmmApBcParams__) \ - msg__ = (CsrWifiNmeApWmmParamUpdateReq *) CsrPmemAlloc(sizeof(CsrWifiNmeApWmmParamUpdateReq)); \ + msg__ = kmalloc(sizeof(CsrWifiNmeApWmmParamUpdateReq), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_AP_PRIM, CSR_WIFI_NME_AP_WMM_PARAM_UPDATE_REQ, dst__, src__); \ memcpy(msg__->wmmApParams, (wmmApParams__), sizeof(CsrWifiSmeWmmAcParams) * 4); \ memcpy(msg__->wmmApBcParams, (wmmApBcParams__), sizeof(CsrWifiSmeWmmAcParams) * 4); @@ -431,7 +431,7 @@ extern const char *CsrWifiNmeApDownstreamPrimNames[CSR_WIFI_NME_AP_PRIM_DOWNSTRE *******************************************************************************/ #define CsrWifiNmeApWmmParamUpdateCfmCreate(msg__, dst__, src__, status__) \ - msg__ = (CsrWifiNmeApWmmParamUpdateCfm *) CsrPmemAlloc(sizeof(CsrWifiNmeApWmmParamUpdateCfm)); \ + msg__ = kmalloc(sizeof(CsrWifiNmeApWmmParamUpdateCfm), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_AP_PRIM, CSR_WIFI_NME_AP_WMM_PARAM_UPDATE_CFM, dst__, src__); \ msg__->status = (status__); @@ -469,7 +469,7 @@ extern const char *CsrWifiNmeApDownstreamPrimNames[CSR_WIFI_NME_AP_PRIM_DOWNSTRE *******************************************************************************/ #define CsrWifiNmeApWpsRegisterReqCreate(msg__, dst__, src__, interfaceTag__, selectedDevicePasswordId__, selectedConfigMethod__, pin__) \ - msg__ = (CsrWifiNmeApWpsRegisterReq *) CsrPmemAlloc(sizeof(CsrWifiNmeApWpsRegisterReq)); \ + msg__ = kmalloc(sizeof(CsrWifiNmeApWpsRegisterReq), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_AP_PRIM, CSR_WIFI_NME_AP_WPS_REGISTER_REQ, dst__, src__); \ msg__->interfaceTag = (interfaceTag__); \ msg__->selectedDevicePasswordId = (selectedDevicePasswordId__); \ @@ -501,7 +501,7 @@ extern const char *CsrWifiNmeApDownstreamPrimNames[CSR_WIFI_NME_AP_PRIM_DOWNSTRE *******************************************************************************/ #define CsrWifiNmeApWpsRegisterCfmCreate(msg__, dst__, src__, interfaceTag__, status__) \ - msg__ = (CsrWifiNmeApWpsRegisterCfm *) CsrPmemAlloc(sizeof(CsrWifiNmeApWpsRegisterCfm)); \ + msg__ = kmalloc(sizeof(CsrWifiNmeApWpsRegisterCfm), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_AP_PRIM, CSR_WIFI_NME_AP_WPS_REGISTER_CFM, dst__, src__); \ msg__->interfaceTag = (interfaceTag__); \ msg__->status = (status__); diff --git a/drivers/staging/csr/csr_wifi_nme_ap_serialize.c b/drivers/staging/csr/csr_wifi_nme_ap_serialize.c index dcdcc32b597..8112aa04328 100644 --- a/drivers/staging/csr/csr_wifi_nme_ap_serialize.c +++ b/drivers/staging/csr/csr_wifi_nme_ap_serialize.c @@ -152,7 +152,7 @@ u8* CsrWifiNmeApConfigSetReqSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiNmeApConfigSetReqDes(u8 *buffer, size_t length) { - CsrWifiNmeApConfigSetReq *primitive = (CsrWifiNmeApConfigSetReq *) CsrPmemAlloc(sizeof(CsrWifiNmeApConfigSetReq)); + CsrWifiNmeApConfigSetReq *primitive = kmalloc(sizeof(CsrWifiNmeApConfigSetReq), GFP_KERNEL); size_t offset; offset = 0; @@ -199,7 +199,7 @@ void* CsrWifiNmeApConfigSetReqDes(u8 *buffer, size_t length) primitive->apMacConfig.macAddressList = NULL; if (primitive->apMacConfig.macAddressListCount) { - primitive->apMacConfig.macAddressList = (CsrWifiMacAddress *)CsrPmemAlloc(sizeof(CsrWifiMacAddress) * primitive->apMacConfig.macAddressListCount); + primitive->apMacConfig.macAddressList = kmalloc(sizeof(CsrWifiMacAddress) * primitive->apMacConfig.macAddressListCount, GFP_KERNEL); } { u16 i2; @@ -255,7 +255,7 @@ u8* CsrWifiNmeApWpsRegisterReqSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiNmeApWpsRegisterReqDes(u8 *buffer, size_t length) { - CsrWifiNmeApWpsRegisterReq *primitive = (CsrWifiNmeApWpsRegisterReq *) CsrPmemAlloc(sizeof(CsrWifiNmeApWpsRegisterReq)); + CsrWifiNmeApWpsRegisterReq *primitive = kmalloc(sizeof(CsrWifiNmeApWpsRegisterReq), GFP_KERNEL); size_t offset; offset = 0; @@ -447,7 +447,7 @@ u8* CsrWifiNmeApStartReqSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiNmeApStartReqDes(u8 *buffer, size_t length) { - CsrWifiNmeApStartReq *primitive = (CsrWifiNmeApStartReq *) CsrPmemAlloc(sizeof(CsrWifiNmeApStartReq)); + CsrWifiNmeApStartReq *primitive = kmalloc(sizeof(CsrWifiNmeApStartReq), GFP_KERNEL); size_t offset; offset = 0; @@ -518,7 +518,7 @@ void* CsrWifiNmeApStartReqDes(u8 *buffer, size_t length) primitive->p2pGoParam.operatingChanList.channelEntryList = NULL; if (primitive->p2pGoParam.operatingChanList.channelEntryListCount) { - primitive->p2pGoParam.operatingChanList.channelEntryList = (CsrWifiSmeApP2pOperatingChanEntry *)CsrPmemAlloc(sizeof(CsrWifiSmeApP2pOperatingChanEntry) * primitive->p2pGoParam.operatingChanList.channelEntryListCount); + primitive->p2pGoParam.operatingChanList.channelEntryList = kmalloc(sizeof(CsrWifiSmeApP2pOperatingChanEntry) * primitive->p2pGoParam.operatingChanList.channelEntryListCount, GFP_KERNEL); } { u16 i3; @@ -528,7 +528,7 @@ void* CsrWifiNmeApStartReqDes(u8 *buffer, size_t length) CsrUint8Des((u8 *) &primitive->p2pGoParam.operatingChanList.channelEntryList[i3].operatingChannelCount, buffer, &offset); if (primitive->p2pGoParam.operatingChanList.channelEntryList[i3].operatingChannelCount) { - primitive->p2pGoParam.operatingChanList.channelEntryList[i3].operatingChannel = (u8 *)CsrPmemAlloc(primitive->p2pGoParam.operatingChanList.channelEntryList[i3].operatingChannelCount); + primitive->p2pGoParam.operatingChanList.channelEntryList[i3].operatingChannel = kmalloc(primitive->p2pGoParam.operatingChanList.channelEntryList[i3].operatingChannelCount, GFP_KERNEL); CsrMemCpyDes(primitive->p2pGoParam.operatingChanList.channelEntryList[i3].operatingChannel, buffer, &offset, ((u16) (primitive->p2pGoParam.operatingChanList.channelEntryList[i3].operatingChannelCount))); } else @@ -641,7 +641,7 @@ u8* CsrWifiNmeApWmmParamUpdateReqSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiNmeApWmmParamUpdateReqDes(u8 *buffer, size_t length) { - CsrWifiNmeApWmmParamUpdateReq *primitive = (CsrWifiNmeApWmmParamUpdateReq *) CsrPmemAlloc(sizeof(CsrWifiNmeApWmmParamUpdateReq)); + CsrWifiNmeApWmmParamUpdateReq *primitive = kmalloc(sizeof(CsrWifiNmeApWmmParamUpdateReq), GFP_KERNEL); size_t offset; offset = 0; @@ -699,7 +699,7 @@ u8* CsrWifiNmeApStaRemoveReqSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiNmeApStaRemoveReqDes(u8 *buffer, size_t length) { - CsrWifiNmeApStaRemoveReq *primitive = (CsrWifiNmeApStaRemoveReq *) CsrPmemAlloc(sizeof(CsrWifiNmeApStaRemoveReq)); + CsrWifiNmeApStaRemoveReq *primitive = kmalloc(sizeof(CsrWifiNmeApStaRemoveReq), GFP_KERNEL); size_t offset; offset = 0; @@ -736,7 +736,7 @@ u8* CsrWifiNmeApWpsRegisterCfmSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiNmeApWpsRegisterCfmDes(u8 *buffer, size_t length) { - CsrWifiNmeApWpsRegisterCfm *primitive = (CsrWifiNmeApWpsRegisterCfm *) CsrPmemAlloc(sizeof(CsrWifiNmeApWpsRegisterCfm)); + CsrWifiNmeApWpsRegisterCfm *primitive = kmalloc(sizeof(CsrWifiNmeApWpsRegisterCfm), GFP_KERNEL); size_t offset; offset = 0; @@ -776,7 +776,7 @@ u8* CsrWifiNmeApStartCfmSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiNmeApStartCfmDes(u8 *buffer, size_t length) { - CsrWifiNmeApStartCfm *primitive = (CsrWifiNmeApStartCfm *) CsrPmemAlloc(sizeof(CsrWifiNmeApStartCfm)); + CsrWifiNmeApStartCfm *primitive = kmalloc(sizeof(CsrWifiNmeApStartCfm), GFP_KERNEL); size_t offset; offset = 0; @@ -814,7 +814,7 @@ u8* CsrWifiNmeApStopCfmSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiNmeApStopCfmDes(u8 *buffer, size_t length) { - CsrWifiNmeApStopCfm *primitive = (CsrWifiNmeApStopCfm *) CsrPmemAlloc(sizeof(CsrWifiNmeApStopCfm)); + CsrWifiNmeApStopCfm *primitive = kmalloc(sizeof(CsrWifiNmeApStopCfm), GFP_KERNEL); size_t offset; offset = 0; @@ -852,7 +852,7 @@ u8* CsrWifiNmeApStopIndSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiNmeApStopIndDes(u8 *buffer, size_t length) { - CsrWifiNmeApStopInd *primitive = (CsrWifiNmeApStopInd *) CsrPmemAlloc(sizeof(CsrWifiNmeApStopInd)); + CsrWifiNmeApStopInd *primitive = kmalloc(sizeof(CsrWifiNmeApStopInd), GFP_KERNEL); size_t offset; offset = 0; @@ -893,7 +893,7 @@ u8* CsrWifiNmeApStationIndSer(u8 *ptr, size_t *len, void *msg) void* CsrWifiNmeApStationIndDes(u8 *buffer, size_t length) { - CsrWifiNmeApStationInd *primitive = (CsrWifiNmeApStationInd *) CsrPmemAlloc(sizeof(CsrWifiNmeApStationInd)); + CsrWifiNmeApStationInd *primitive = kmalloc(sizeof(CsrWifiNmeApStationInd), GFP_KERNEL); size_t offset; offset = 0; diff --git a/drivers/staging/csr/csr_wifi_nme_lib.h b/drivers/staging/csr/csr_wifi_nme_lib.h index 4d8f3f14ce6..04b7c31342c 100644 --- a/drivers/staging/csr/csr_wifi_nme_lib.h +++ b/drivers/staging/csr/csr_wifi_nme_lib.h @@ -100,7 +100,7 @@ extern const char *CsrWifiNmeDownstreamPrimNames[CSR_WIFI_NME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiNmeConnectionStatusGetReqCreate(msg__, dst__, src__, interfaceTag__) \ - msg__ = (CsrWifiNmeConnectionStatusGetReq *) CsrPmemAlloc(sizeof(CsrWifiNmeConnectionStatusGetReq)); \ + msg__ = kmalloc(sizeof(CsrWifiNmeConnectionStatusGetReq), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_CONNECTION_STATUS_GET_REQ, dst__, src__); \ msg__->interfaceTag = (interfaceTag__); @@ -131,7 +131,7 @@ extern const char *CsrWifiNmeDownstreamPrimNames[CSR_WIFI_NME_PRIM_DOWNSTREAM_CO *******************************************************************************/ #define CsrWifiNmeConnectionStatusGetCfmCreate(msg__, dst__, src__, interfaceTag__, status__, connectionStatus__) \ - msg__ = (CsrWifiNmeConnectionStatusGetCfm *) CsrPmemAlloc(sizeof(CsrWifiNmeConnectionStatusGetCfm)); \ + msg__ = kmalloc(sizeof(CsrWifiNmeConnectionStatusGetCfm), GFP_KERNEL); \ CsrWifiFsmEventInit(&msg__->common, CSR_WIFI_NME_PRIM, CSR_WIFI_NME_CONNECTION_STATUS_GET_CFM, dst__, src__); \ msg__->interfaceTag = (interfaceTag__); \ msg__->status = (status__); \ @@ -164,7 +164,7 @@ extern const char *CsrWifiNmeDownstreamPrimNames[CSR_WIFI_NME_PRIM_DOWNSTREAM_CO ********************************************************************** |