From 86d0f111bd0709437eb3f568c8348232d4e4ac00 Mon Sep 17 00:00:00 2001 From: Arif Hussain Date: Tue, 28 Feb 2017 15:50:32 -0800 Subject: qcacld-3.0: Change dynamic memory to static from .bss segment for p_mac Size of global context handler p_mac is too big to allocate memory and more possibility of failing memory allocation of this big size. So use mac global context from .bss segment by using global static variable. Change-Id: I3638b576b76c26181cb180d8b37e195ba3b0ecad CRs-Fixed: 2011049 --- .../src/sys/legacy/src/system/src/mac_init_api.c | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/core/mac/src/sys/legacy/src/system/src/mac_init_api.c b/core/mac/src/sys/legacy/src/system/src/mac_init_api.c index 8c0c432dae7e..9fd4a2a6771f 100644 --- a/core/mac/src/sys/legacy/src/system/src/mac_init_api.c +++ b/core/mac/src/sys/legacy/src/system/src/mac_init_api.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011-2016 The Linux Foundation. All rights reserved. + * Copyright (c) 2011-2017 The Linux Foundation. All rights reserved. * * Previously licensed under the ISC license by Qualcomm Atheros, Inc. * @@ -49,6 +49,8 @@ #include "mac_trace.h" #endif +static tAniSirGlobal global_mac_context; + extern tSirRetStatus halDoCfgInit(tpAniSirGlobal pMac); extern tSirRetStatus halProcessStartEvent(tpAniSirGlobal pMac); @@ -106,24 +108,12 @@ tSirRetStatus mac_stop(tHalHandle hHal, tHalStopType stopType) tSirRetStatus mac_open(tHalHandle *pHalHandle, tHddHandle hHdd, struct cds_config_info *cds_cfg) { - tpAniSirGlobal p_mac = NULL; + tpAniSirGlobal p_mac = &global_mac_context; tSirRetStatus status = eSIR_SUCCESS; if (pHalHandle == NULL) return eSIR_FAILURE; - /* - * Make sure this adapter is not already opened. (Compare pAdapter pointer in already - * allocated p_mac structures.) - * If it is opened just return pointer to previously allocated p_mac pointer. - * Or should this result in error? - */ - - /* Allocate p_mac */ - p_mac = qdf_mem_malloc(sizeof(tAniSirGlobal)); - if (NULL == p_mac) - return eSIR_MEM_ALLOC_FAILED; - /* * Set various global fields of p_mac here * (Could be platform dependant as some variables in p_mac are platform @@ -184,8 +174,5 @@ tSirRetStatus mac_close(tHalHandle hHal) log_deinit(pMac); - /* Finally, de-allocate the global MAC datastructure: */ - qdf_mem_free(pMac); - return eSIR_SUCCESS; } -- cgit v1.2.3