From 7aaeeea31597007e4298e3e84b221767292d88be Mon Sep 17 00:00:00 2001 From: Jeff Johnson Date: Tue, 26 Sep 2017 13:16:24 -0700 Subject: [PATCH] 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 --- core/cds/inc/cds_api.h | 12 +++++++++++- core/cds/src/cds_api.c | 13 ++----------- core/hdd/src/wlan_hdd_main.c | 6 +++--- 3 files changed, 16 insertions(+), 15 deletions(-) diff --git a/core/cds/inc/cds_api.h b/core/cds/inc/cds_api.h index dfa94d7edbe8..7861d76b6d07 100644 --- a/core/cds/inc/cds_api.h +++ b/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); diff --git a/core/cds/src/cds_api.c b/core/cds/src/cds_api.c index 2e39afedada9..47ad885d1032 100644 --- a/core/cds/src/cds_api.c +++ b/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; } /** diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index d3e4f65c886a..a5916566f812 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/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;