Bläddra i källkod

qcacld-3.0: Change return value of cds_init()

Currently cds_init() returns a pointer to the CDS Global Context.  At
one time this was necessary since it was required to subsequently pass
this context pointer to other CDS APIs. But now CDS internally
maintains a pointer to its context, and no CDS APIs now require this
pointer, so no longer return the pointer. The ultimate goal is to keep
all references to the CDS context inside CDS.

Change-Id: Id068a2d351e492eca7b84ef23f277939104c8b46
CRs-Fixed: 2117004
Jeff Johnson 7 år sedan
förälder
incheckning
7aaeeea315
3 ändrade filer med 16 tillägg och 15 borttagningar
  1. 11 1
      core/cds/inc/cds_api.h
  2. 2 11
      core/cds/src/cds_api.c
  3. 3 3
      core/hdd/src/wlan_hdd_main.c

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

@@ -306,7 +306,17 @@ static inline bool cds_is_driver_loaded(void)
 	return __CDS_IS_DRIVER_STATE(state, CDS_DRIVER_STATE_LOADED);
 }
 
-v_CONTEXT_t cds_init(void);
+/**
+ * cds_init() - Initialize CDS
+ *
+ * This function allocates the resource required for CDS, but does not
+ * initialize all the members. This overall initialization will happen at
+ * cds_open().
+ *
+ * Return: QDF_STATUS_SUCCESS if CDS was initialized and an error on failure
+ */
+QDF_STATUS cds_init(void);
+
 void cds_deinit(void);
 
 QDF_STATUS cds_pre_enable(void);

+ 2 - 11
core/cds/src/cds_api.c

@@ -156,16 +156,7 @@ uint8_t cds_get_datapath_handles(void **soc, struct cdp_pdev **pdev,
 }
 
 
-/**
- * cds_init() - Initialize CDS
- *
- * This function allocates the resource required for CDS, but does not
- * initialize all the members. This overall initialization will happen at
- * cds_open().
- *
- * Return: Global context on success and NULL on failure.
- */
-v_CONTEXT_t cds_init(void)
+QDF_STATUS cds_init(void)
 {
 	qdf_debugfs_init();
 	qdf_lock_stats_init();
@@ -189,7 +180,7 @@ v_CONTEXT_t cds_init(void)
 
 	cds_recovery_work_init();
 
-	return gp_cds_context;
+	return gp_cds_context ? QDF_STATUS_SUCCESS : QDF_STATUS_E_FAILURE;
 }
 
 /**

+ 3 - 3
core/hdd/src/wlan_hdd_main.c

@@ -10948,10 +10948,10 @@ static void hdd_qdf_print_deinit(void)
  */
 int hdd_init(void)
 {
-	v_CONTEXT_t p_cds_context = NULL;
+	QDF_STATUS status;
 	int ret = 0;
 
-	p_cds_context = cds_init();
+	status = cds_init();
 
 	wlan_init_bug_report_lock();
 
@@ -10959,7 +10959,7 @@ int hdd_init(void)
 	wlan_logging_sock_init_svc();
 #endif
 
-	if (p_cds_context == NULL) {
+	if (QDF_IS_STATUS_ERROR(status)) {
 		hdd_err("Failed to allocate CDS context");
 		ret = -ENOMEM;
 		goto err_out;