qcacld-3.0: Add caller function name to cds_get_context()

Add caller function name to cds_get_context() to log incase
of error. Hence calling functions can avoid logging in case if
cds_get_context() returns NULL. This reduces logging and
thereby memory foot print.

Change-Id: I2fce65c020ccd0e8545c38ca2528392ccfd3bd92
CRs-Fixed: 2795670
This commit is contained in:
Srinivas Girigowda
2020-10-12 14:08:42 -07:00
committed by snandini
parent 7ebfcd460b
commit c590a15c17
2 changed files with 21 additions and 19 deletions

View File

@@ -354,7 +354,21 @@ QDF_STATUS cds_close(struct wlan_objmgr_psoc *psoc);
*/ */
QDF_STATUS cds_dp_close(struct wlan_objmgr_psoc *psoc); QDF_STATUS cds_dp_close(struct wlan_objmgr_psoc *psoc);
void *cds_get_context(QDF_MODULE_ID module_id); /**
* cds_get_context() - get context data area
* @module_id: ID of the module who's context data is being retrieved.
*
* Each module in the system has a context/data area that is allocated
* and managed by CDS. This API allows any user to get a pointer to its
* allocated context data area from the CDS global context.
*
* Return: pointer to the context data area of the module ID
* specified, or NULL if the context data is not allocated for
* the module ID specified.
*/
#define cds_get_context(module_id) \
__cds_get_context(module_id, __func__)
void *__cds_get_context(QDF_MODULE_ID module_id, const char *func);
void *cds_get_global_context(void); void *cds_get_global_context(void);

View File

@@ -1400,25 +1400,12 @@ QDF_STATUS cds_dp_close(struct wlan_objmgr_psoc *psoc)
return QDF_STATUS_SUCCESS; return QDF_STATUS_SUCCESS;
} }
/** void *__cds_get_context(QDF_MODULE_ID module_id, const char *func)
* cds_get_context() - get context data area
*
* @module_id: ID of the module who's context data is being retrieved.
*
* Each module in the system has a context / data area that is allocated
* and managed by CDS. This API allows any user to get a pointer to its
* allocated context data area from the CDS global context.
*
* Return: pointer to the context data area of the module ID
* specified, or NULL if the context data is not allocated for
* the module ID specified
*/
void *cds_get_context(QDF_MODULE_ID module_id)
{ {
void *context = NULL; void *context = NULL;
if (!gp_cds_context) { if (!gp_cds_context) {
cds_err("cds context pointer is null"); cds_err("cds context pointer is null (via %s)", func);
return NULL; return NULL;
} }
@@ -1489,15 +1476,16 @@ void *cds_get_context(QDF_MODULE_ID module_id)
default: default:
{ {
cds_err("Module ID %i does not have its context maintained by CDS", cds_err("Module ID %d does not have its context maintained by CDS (via %s)",
module_id); module_id, func);
QDF_ASSERT(0); QDF_ASSERT(0);
return NULL; return NULL;
} }
} }
if (!context) if (!context)
cds_err("Module ID %i context is Null", module_id); cds_err("Module ID %d context is Null (via %s)",
module_id, func);
return context; return context;
} /* cds_get_context() */ } /* cds_get_context() */