ソースを参照

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
Srinivas Girigowda 4 年 前
コミット
c590a15c17
2 ファイル変更21 行追加19 行削除
  1. 15 1
      core/cds/inc/cds_api.h
  2. 6 18
      core/cds/src/cds_api.c

+ 15 - 1
core/cds/inc/cds_api.h

@@ -354,7 +354,21 @@ QDF_STATUS cds_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);
 

+ 6 - 18
core/cds/src/cds_api.c

@@ -1400,25 +1400,12 @@ QDF_STATUS cds_dp_close(struct wlan_objmgr_psoc *psoc)
 	return QDF_STATUS_SUCCESS;
 }
 
-/**
- * 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 *__cds_get_context(QDF_MODULE_ID module_id, const char *func)
 {
 	void *context = NULL;
 
 	if (!gp_cds_context) {
-		cds_err("cds context pointer is null");
+		cds_err("cds context pointer is null (via %s)", func);
 		return NULL;
 	}
 
@@ -1489,15 +1476,16 @@ void *cds_get_context(QDF_MODULE_ID module_id)
 
 	default:
 	{
-		cds_err("Module ID %i does not have its context maintained by CDS",
-			module_id);
+		cds_err("Module ID %d does not have its context maintained by CDS (via %s)",
+			module_id, func);
 		QDF_ASSERT(0);
 		return NULL;
 	}
 	}
 
 	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;
 } /* cds_get_context() */