Эх сурвалжийг харах

qcacmn: Cleanup unused TWT APIs & validation checks

PSOC null sanity check is done in caller, but again done in few
callee APIs.

Remove the duplicate sanity checks and unused TWT API.

Change-Id: Iac485bdce27be41c0d7152de1c86626edb534d11
CRs-Fixed: 3402622
Pragaspathi Thilagaraj 2 жил өмнө
parent
commit
28a0436d35

+ 2 - 14
target_if/twt/src/target_if_twt.c

@@ -31,11 +31,6 @@ target_if_twt_register_events(struct wlan_objmgr_psoc *psoc)
 	QDF_STATUS status;
 	struct wmi_unified *wmi_handle;
 
-	if (!psoc) {
-		target_if_err("psoc obj is null!");
-		return QDF_STATUS_E_NULL_VALUE;
-	}
-
 	wmi_handle = get_wmi_unified_hdl_from_psoc(psoc);
 	if (!wmi_handle) {
 		target_if_err("wmi_handle is null!");
@@ -151,15 +146,8 @@ QDF_STATUS
 target_if_twt_set_twt_ack_support(struct wlan_objmgr_psoc *psoc,
 				  bool val)
 {
-	struct twt_psoc_priv_obj *twt_psoc;
-
-	if (!psoc) {
-		target_if_err("null psoc");
-		return QDF_STATUS_E_FAILURE;
-	}
-
-	twt_psoc = wlan_objmgr_psoc_get_comp_private_obj(psoc,
-							 WLAN_UMAC_COMP_TWT);
+	struct twt_psoc_priv_obj *twt_psoc =
+		wlan_objmgr_psoc_get_comp_private_obj(psoc, WLAN_UMAC_COMP_TWT);
 	if (!twt_psoc) {
 		target_if_err("null twt psoc priv obj");
 		return QDF_STATUS_E_FAILURE;

+ 0 - 78
umac/twt/core/src/wlan_twt_common.c

@@ -30,11 +30,6 @@ wlan_twt_tgt_caps_get_responder(struct wlan_objmgr_psoc *psoc, bool *val)
 {
 	struct twt_psoc_priv_obj *twt_psoc;
 
-	if (!psoc) {
-		twt_err("null psoc");
-		return QDF_STATUS_E_FAILURE;
-	}
-
 	twt_psoc = wlan_objmgr_psoc_get_comp_private_obj(psoc,
 							 WLAN_UMAC_COMP_TWT);
 	if (!twt_psoc) {
@@ -46,39 +41,12 @@ wlan_twt_tgt_caps_get_responder(struct wlan_objmgr_psoc *psoc, bool *val)
 	return QDF_STATUS_SUCCESS;
 }
 
-QDF_STATUS
-wlan_twt_tgt_caps_get_legacy_bcast_support(struct wlan_objmgr_psoc *psoc,
-					   bool *val)
-{
-	struct twt_psoc_priv_obj *twt_psoc;
-
-	if (!psoc) {
-		twt_err("null psoc");
-		return QDF_STATUS_E_FAILURE;
-	}
-
-	twt_psoc = wlan_objmgr_psoc_get_comp_private_obj(psoc,
-							 WLAN_UMAC_COMP_TWT);
-	if (!twt_psoc) {
-		twt_err("null twt psoc priv obj");
-		return QDF_STATUS_E_FAILURE;
-	}
-
-	*val = twt_psoc->twt_caps.legacy_bcast_twt_support;
-	return QDF_STATUS_SUCCESS;
-}
-
 QDF_STATUS
 wlan_twt_tgt_caps_get_nudge_enabled(struct wlan_objmgr_psoc *psoc,
 				    bool *val)
 {
 	struct twt_psoc_priv_obj *twt_psoc;
 
-	if (!psoc) {
-		twt_err("null psoc");
-		return QDF_STATUS_E_FAILURE;
-	}
-
 	twt_psoc = wlan_objmgr_psoc_get_comp_private_obj(psoc,
 							 WLAN_UMAC_COMP_TWT);
 	if (!twt_psoc) {
@@ -96,11 +64,6 @@ wlan_twt_tgt_caps_get_all_twt_enabled(struct wlan_objmgr_psoc *psoc,
 {
 	struct twt_psoc_priv_obj *twt_psoc;
 
-	if (!psoc) {
-		twt_err("null psoc");
-		return QDF_STATUS_E_FAILURE;
-	}
-
 	twt_psoc = wlan_objmgr_psoc_get_comp_private_obj(psoc,
 							 WLAN_UMAC_COMP_TWT);
 	if (!twt_psoc) {
@@ -118,11 +81,6 @@ wlan_twt_tgt_caps_get_stats_enabled(struct wlan_objmgr_psoc *psoc,
 {
 	struct twt_psoc_priv_obj *twt_psoc;
 
-	if (!psoc) {
-		twt_err("null psoc");
-		return QDF_STATUS_E_FAILURE;
-	}
-
 	twt_psoc = wlan_objmgr_psoc_get_comp_private_obj(psoc,
 							 WLAN_UMAC_COMP_TWT);
 	if (!twt_psoc) {
@@ -161,12 +119,6 @@ wlan_twt_tgt_caps_get_ack_supported(struct wlan_objmgr_psoc *psoc,
 {
 	struct twt_psoc_priv_obj *twt_psoc;
 
-	if (!psoc) {
-		twt_err("null psoc");
-		*val = false;
-		return QDF_STATUS_E_FAILURE;
-	}
-
 	twt_psoc = wlan_objmgr_psoc_get_comp_private_obj(psoc,
 							 WLAN_UMAC_COMP_TWT);
 	if (!twt_psoc) {
@@ -208,11 +160,6 @@ wlan_twt_requestor_disable(struct wlan_objmgr_psoc *psoc,
 {
 	struct twt_psoc_priv_obj *twt_psoc;
 
-	if (!psoc) {
-		twt_err("null psoc");
-		return QDF_STATUS_E_FAILURE;
-	}
-
 	twt_psoc = wlan_objmgr_psoc_get_comp_private_obj(psoc,
 							 WLAN_UMAC_COMP_TWT);
 	if (!twt_psoc) {
@@ -239,11 +186,6 @@ wlan_twt_responder_disable(struct wlan_objmgr_psoc *psoc,
 {
 	struct twt_psoc_priv_obj *twt_psoc;
 
-	if (!psoc) {
-		twt_err("null psoc");
-		return QDF_STATUS_E_FAILURE;
-	}
-
 	twt_psoc = wlan_objmgr_psoc_get_comp_private_obj(psoc,
 							 WLAN_UMAC_COMP_TWT);
 	if (!twt_psoc) {
@@ -271,11 +213,6 @@ wlan_twt_requestor_enable(struct wlan_objmgr_psoc *psoc,
 	struct twt_psoc_priv_obj *twt_psoc;
 	bool requestor_en = false, twt_bcast_requestor = false;
 
-	if (!psoc) {
-		twt_err("null psoc");
-		return QDF_STATUS_E_FAILURE;
-	}
-
 	twt_psoc = wlan_objmgr_psoc_get_comp_private_obj(psoc,
 							 WLAN_UMAC_COMP_TWT);
 	if (!twt_psoc) {
@@ -317,11 +254,6 @@ wlan_twt_responder_enable(struct wlan_objmgr_psoc *psoc,
 	struct twt_psoc_priv_obj *twt_psoc;
 	bool responder_en = false, twt_bcast_responder = false;
 
-	if (!psoc) {
-		twt_err("null psoc");
-		return QDF_STATUS_E_FAILURE;
-	}
-
 	twt_psoc = wlan_objmgr_psoc_get_comp_private_obj(psoc,
 							 WLAN_UMAC_COMP_TWT);
 	if (!twt_psoc) {
@@ -429,11 +361,6 @@ wlan_twt_enable_event_handler(struct wlan_objmgr_psoc *psoc,
 	struct twt_psoc_priv_obj *twt_psoc;
 	struct twt_en_dis_context *twt_context;
 
-	if (!psoc) {
-		twt_err("null psoc");
-		return QDF_STATUS_E_FAILURE;
-	}
-
 	twt_psoc = wlan_objmgr_psoc_get_comp_private_obj(psoc,
 							 WLAN_UMAC_COMP_TWT);
 	if (!twt_psoc) {
@@ -473,11 +400,6 @@ wlan_twt_disable_event_handler(struct wlan_objmgr_psoc *psoc,
 	struct twt_psoc_priv_obj *twt_psoc;
 	struct twt_en_dis_context *twt_context;
 
-	if (!psoc) {
-		twt_err("null psoc");
-		return QDF_STATUS_E_FAILURE;
-	}
-
 	twt_psoc = wlan_objmgr_psoc_get_comp_private_obj(psoc,
 							 WLAN_UMAC_COMP_TWT);
 	if (!twt_psoc) {

+ 0 - 11
umac/twt/core/src/wlan_twt_common.h

@@ -31,17 +31,6 @@
 QDF_STATUS
 wlan_twt_tgt_caps_get_responder(struct wlan_objmgr_psoc *psoc, bool *val);
 
-/**
- * wlan_twt_tgt_caps_get_legacy_bcast_support() - get legacy bcast support
- * @psoc: psoc handle
- * @val: pointer to the output variable
- *
- * return: QDF_STATUS
- */
-QDF_STATUS
-wlan_twt_tgt_caps_get_legacy_bcast_support(struct wlan_objmgr_psoc *psoc,
-					   bool *val);
-
 /**
  * wlan_twt_tgt_caps_get_bcast_req_support() - get bcast requestor support
  * @psoc: psoc handle

+ 0 - 11
umac/twt/dispatcher/inc/wlan_twt_ucfg_api.h

@@ -36,17 +36,6 @@
 QDF_STATUS
 ucfg_twt_get_responder(struct wlan_objmgr_psoc *psoc, bool *val);
 
-/**
- * ucfg_twt_get_legacy_bcast_twt_support() - get legacy bcast support
- * @psoc: psoc handle
- * @val: pointer to the output variable
- *
- * return: QDF_STATUS
- */
-QDF_STATUS
-ucfg_twt_get_legacy_bcast_twt_support(struct wlan_objmgr_psoc *psoc,
-				      bool *val);
-
 /**
  * ucfg_twt_get_twt_nudge_enabled() - get twt nudge enabled
  * @psoc: psoc handle

+ 12 - 28
umac/twt/dispatcher/src/wlan_twt_api.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
  *
  * Permission to use, copy, modify, and/or distribute this software for
  * any purpose with or without fee is hereby granted, provided that the
@@ -28,11 +28,6 @@ wlan_twt_get_tx_ops(struct wlan_objmgr_psoc *psoc)
 {
 	struct wlan_lmac_if_tx_ops *tx_ops;
 
-	if (!psoc) {
-		twt_err("psoc is null");
-		return NULL;
-	}
-
 	tx_ops = wlan_psoc_get_lmac_if_txops(psoc);
 	if (!tx_ops) {
 		twt_err("tx_ops is NULL");
@@ -47,11 +42,6 @@ wlan_twt_get_rx_ops(struct wlan_objmgr_psoc *psoc)
 {
 	struct wlan_lmac_if_rx_ops *rx_ops;
 
-	if (!psoc) {
-		twt_err("psoc is null");
-		return NULL;
-	}
-
 	rx_ops = wlan_psoc_get_lmac_if_rxops(psoc);
 	if (!rx_ops) {
 		twt_err("rx_ops is NULL");
@@ -220,18 +210,14 @@ QDF_STATUS twt_psoc_enable(struct wlan_objmgr_psoc *psoc)
 	struct wlan_lmac_if_twt_tx_ops *tx_ops;
 
 	tx_ops = wlan_twt_get_tx_ops(psoc);
-	if (!tx_ops) {
-		twt_err("tx_ops is null");
+	if (!tx_ops || !tx_ops->register_events) {
+		twt_err("%s is null", !tx_ops ? "tx_ops" : "register_events");
 		return QDF_STATUS_E_NULL_VALUE;
 	}
 
-	if (tx_ops->register_events) {
-		status = tx_ops->register_events(psoc);
-
-		if (QDF_IS_STATUS_ERROR(status))
-			twt_err("twt_register_events failed (status=%d)",
-				status);
-	}
+	status = tx_ops->register_events(psoc);
+	if (QDF_IS_STATUS_ERROR(status))
+		twt_err("twt_register_events failed (status=%d)", status);
 
 	return status;
 }
@@ -242,18 +228,16 @@ QDF_STATUS twt_psoc_disable(struct wlan_objmgr_psoc *psoc)
 	struct wlan_lmac_if_twt_tx_ops *tx_ops;
 
 	tx_ops = wlan_twt_get_tx_ops(psoc);
-	if (!tx_ops) {
-		twt_err("tx_ops is null");
+	if (!tx_ops || !tx_ops->deregister_events) {
+		twt_err("%s is null", !tx_ops ? "tx_ops" : "deregister_events");
 		return QDF_STATUS_E_NULL_VALUE;
 	}
 
-	if (tx_ops->deregister_events) {
-		status = tx_ops->deregister_events(psoc);
+	status = tx_ops->deregister_events(psoc);
+	if (QDF_IS_STATUS_ERROR(status))
+		twt_err("twt_deregister_events failed (status=%d)",
+			status);
 
-		if (QDF_IS_STATUS_ERROR(status))
-			twt_err("twt_deregister_events failed (status=%d)",
-				status);
-	}
 	return status;
 }
 

+ 1 - 21
umac/twt/dispatcher/src/wlan_twt_tgt_if_tx_api.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
  *
  * Permission to use, copy, modify, and/or distribute this software for
  * any purpose with or without fee is hereby granted, provided that the
@@ -35,16 +35,6 @@ tgt_twt_enable_req_send(struct wlan_objmgr_psoc *psoc,
 	struct wlan_lmac_if_twt_tx_ops *tx_ops;
 	QDF_STATUS status;
 
-	if (!psoc) {
-		twt_err("null psoc");
-		return QDF_STATUS_E_INVAL;
-	}
-
-	if (!req) {
-		twt_err("Invalid input");
-		return QDF_STATUS_E_INVAL;
-	}
-
 	tx_ops = wlan_twt_get_tx_ops(psoc);
 	if (!tx_ops || !tx_ops->enable_req) {
 		twt_err("twt enable_req tx_ops is null");
@@ -67,16 +57,6 @@ tgt_twt_disable_req_send(struct wlan_objmgr_psoc *psoc,
 	struct wlan_lmac_if_twt_tx_ops *tx_ops;
 	QDF_STATUS status;
 
-	if (!psoc) {
-		twt_err("null psoc");
-		return QDF_STATUS_E_INVAL;
-	}
-
-	if (!req) {
-		twt_err("Invalid input");
-		return QDF_STATUS_E_INVAL;
-	}
-
 	tx_ops = wlan_twt_get_tx_ops(psoc);
 	if (!tx_ops || !tx_ops->disable_req) {
 		twt_err("twt disable_req tx_ops is null");

+ 0 - 6
umac/twt/dispatcher/src/wlan_twt_ucfg_api.c

@@ -26,12 +26,6 @@ QDF_STATUS ucfg_twt_get_responder(struct wlan_objmgr_psoc *psoc, bool *val)
 	return wlan_twt_tgt_caps_get_responder(psoc, val);
 }
 
-QDF_STATUS ucfg_twt_get_legacy_bcast_twt_support(struct wlan_objmgr_psoc *psoc,
-						bool *val)
-{
-	return wlan_twt_tgt_caps_get_legacy_bcast_support(psoc, val);
-}
-
 QDF_STATUS ucfg_twt_get_twt_nudge_enabled(struct wlan_objmgr_psoc *psoc,
 					bool *val)
 {