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
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 dc8d7f4..319c2b8 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
@@ -48,6 +48,8 @@
 #include "mac_trace.h"
 #endif
 
+static tAniSirGlobal global_mac_context;
+
 extern tSirRetStatus halDoCfgInit(tpAniSirGlobal pMac);
 extern tSirRetStatus halProcessStartEvent(tpAniSirGlobal pMac);
 
@@ -103,7 +105,7 @@
 tSirRetStatus mac_open(struct wlan_objmgr_psoc *psoc, tHalHandle *pHalHandle,
 			tHddHandle hHdd, struct cds_config_info *cds_cfg)
 {
-	tpAniSirGlobal p_mac = NULL;
+	tpAniSirGlobal p_mac = &global_mac_context;
 	tSirRetStatus status = eSIR_SUCCESS;
 	QDF_STATUS qdf_status;
 
@@ -111,18 +113,6 @@
 		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
 	 * dependant)
@@ -188,8 +178,6 @@
 	}
 	wlan_objmgr_psoc_release_ref(pMac->psoc, WLAN_LEGACY_MAC_ID);
 	pMac->psoc = NULL;
-	/* Finally, de-allocate the global MAC datastructure: */
-	qdf_mem_free(pMac);
 
 	return eSIR_SUCCESS;
 }