Ver Fonte

qcacld-3.0: Replace typedef tSirSmeDeauthReq

The Linux Coding Style enumerates a few special cases where typedefs
are useful, but stresses "NEVER EVER use a typedef unless you can
clearly match one of those rules." The tSirSmeDeauthReq typedef does
not meet any of those criteria, so replace it (and the "tp" variant)
with a reference to the underlying struct.

Further note the Linux Coding Style frowns upon mixed-case names and
so-called Hungarian notation, so in conjunction rename the underlying
struct to be in compliance.

Change-Id: I861e0589a336899808c5b3add327b8a843086110
CRs-Fixed: 2395991
Jeff Johnson há 6 anos atrás
pai
commit
34c74b0182

+ 2 - 3
core/mac/inc/sir_api.h

@@ -1284,9 +1284,8 @@ struct sir_sme_discon_done_ind {
 	tSirMacAddr        peer_mac;
 };
 
-
 /* / Definition for Deauthetication request */
-typedef struct sSirSmeDeauthReq {
+struct deauth_req {
 	uint16_t messageType;   /* eWNI_SME_DEAUTH_REQ */
 	uint16_t length;
 	uint8_t sessionId;      /* Session ID */
@@ -1294,7 +1293,7 @@ typedef struct sSirSmeDeauthReq {
 	struct qdf_mac_addr bssid;      /* AP BSSID */
 	struct qdf_mac_addr peer_macaddr;
 	uint16_t reasonCode;
-} tSirSmeDeauthReq, *tpSirSmeDeauthReq;
+};
 
 /* / Definition for Deauthetication response */
 typedef struct sSirSmeDeauthRsp {

+ 4 - 4
core/mac/src/pe/lim/lim_process_sme_req_messages.c

@@ -2428,14 +2428,14 @@ static void __lim_process_sme_deauth_req(struct mac_context *mac_ctx,
 {
 	uint16_t deauth_trigger, reason_code;
 	tLimMlmDeauthReq *mlm_deauth_req;
-	tSirSmeDeauthReq sme_deauth_req;
+	struct deauth_req sme_deauth_req;
 	tSirResultCodes ret_code = eSIR_SME_SUCCESS;
 	struct pe_session *session_entry;
 	uint8_t session_id;      /* PE sessionId */
 	uint8_t sme_session_id;
 	uint16_t sme_transaction_id;
 
-	qdf_mem_copy(&sme_deauth_req, msg_buf, sizeof(tSirSmeDeauthReq));
+	qdf_mem_copy(&sme_deauth_req, msg_buf, sizeof(sme_deauth_req));
 	sme_session_id = sme_deauth_req.sessionId;
 	sme_transaction_id = sme_deauth_req.transactionId;
 
@@ -4783,11 +4783,11 @@ static void lim_process_sme_disassoc_req(struct mac_context *mac_ctx,
 static void lim_process_sme_deauth_req(struct mac_context *mac_ctx,
 				       struct scheduler_msg *msg)
 {
-	tSirSmeDeauthReq sme_deauth_req;
+	struct deauth_req sme_deauth_req;
 	struct pe_session *session;
 	uint8_t session_id;
 
-	qdf_mem_copy(&sme_deauth_req, msg->bodyptr, sizeof(tSirSmeDeauthReq));
+	qdf_mem_copy(&sme_deauth_req, msg->bodyptr, sizeof(sme_deauth_req));
 
 	session = pe_find_session_by_bssid(mac_ctx,
 					   sme_deauth_req.bssid.bytes,

+ 5 - 25
core/mac/src/pe/lim/lim_sme_req_utils.c

@@ -530,32 +530,12 @@ bool lim_is_sme_disassoc_cnf_valid(struct mac_context *mac,
 	return true;
 } /*** end lim_is_sme_disassoc_cnf_valid() ***/
 
-/**
- * lim_is_sme_deauth_req_valid()
- *
- ***FUNCTION:
- * This function is called by lim_process_sme_req_messages() upon
- * receiving SME_DEAUTH_REQ message from application.
- *
- ***LOGIC:
- * Message validity checks are performed in this function
- *
- ***ASSUMPTIONS:
- *
- ***NOTE:
- *
- * @param  mac       Pointer to Global MAC structure
- * @param  pDeauthReq Pointer to received SME_DEAUTH_REQ message
- * @return true       When received SME_DEAUTH_REQ is formatted correctly
- *         false      otherwise
- */
-
-uint8_t
-lim_is_sme_deauth_req_valid(struct mac_context *mac, tpSirSmeDeauthReq pDeauthReq,
-			    struct pe_session *pe_session)
+bool lim_is_sme_deauth_req_valid(struct mac_context *mac,
+				 struct deauth_req *deauth_req,
+				 struct pe_session *pe_session)
 {
-	if (qdf_is_macaddr_group(&pDeauthReq->peer_macaddr) &&
-	    !qdf_is_macaddr_broadcast(&pDeauthReq->peer_macaddr))
+	if (qdf_is_macaddr_group(&deauth_req->peer_macaddr) &&
+	    !qdf_is_macaddr_broadcast(&deauth_req->peer_macaddr))
 		return false;
 
 	return true;

+ 16 - 1
core/mac/src/pe/lim/lim_sme_req_utils.h

@@ -81,7 +81,22 @@ bool lim_is_sme_disassoc_req_valid(struct mac_context *mac,
 				   struct disassoc_req *disassoc_req,
 				   struct pe_session *pe_session);
 
-uint8_t lim_is_sme_deauth_req_valid(struct mac_context *, tpSirSmeDeauthReq, struct pe_session *);
+/**
+ * lim_is_sme_deauth_req_valid() - Validate deauth req message
+ * @mac: Pointer to Global MAC structure
+ * @disassoc_req: Pointer to received SME_DEAUTH_REQ message
+ * @pe_session: Pointer to the PE session
+ *
+ * This function is called by lim_process_sme_req_messages() upon
+ * receiving SME_DEAUTH_REQ message from application.
+ *
+ * Return: true  When received SME_DEAUTH_REQ is formatted correctly
+ *         false otherwise
+ */
+bool lim_is_sme_deauth_req_valid(struct mac_context *mac,
+				 struct deauth_req *deauth_req,
+				 struct pe_session *pe_session);
+
 uint8_t lim_is_sme_set_context_req_valid(struct mac_context *, tpSirSmeSetContextReq);
 uint8_t lim_is_sme_stop_bss_req_valid(uint32_t *);
 

+ 6 - 6
core/sme/src/csr/csr_api_roam.c

@@ -15366,22 +15366,22 @@ QDF_STATUS csr_set_ht2040_mode(struct mac_context *mac, uint32_t sessionId,
 }
 #endif
 
-QDF_STATUS csr_send_mb_deauth_req_msg(struct mac_context *mac, uint32_t sessionId,
+QDF_STATUS csr_send_mb_deauth_req_msg(struct mac_context *mac,
+				      uint32_t sessionId,
 				      tSirMacAddr bssId, uint16_t reasonCode)
 {
-	tSirSmeDeauthReq *pMsg;
+	struct deauth_req *pMsg;
 	struct csr_roam_session *pSession = CSR_GET_SESSION(mac, sessionId);
 
 	if (!CSR_IS_SESSION_VALID(mac, sessionId))
 		return QDF_STATUS_E_FAILURE;
 
-	pMsg = qdf_mem_malloc(sizeof(tSirSmeDeauthReq));
-	if (NULL == pMsg)
+	pMsg = qdf_mem_malloc(sizeof(*pMsg));
+	if (!pMsg)
 		return QDF_STATUS_E_NOMEM;
 
-	qdf_mem_zero(pMsg, sizeof(tSirSmeDeauthReq));
 	pMsg->messageType = eWNI_SME_DEAUTH_REQ;
-	pMsg->length = sizeof(tSirSmeDeauthReq);
+	pMsg->length = sizeof(*pMsg);
 	pMsg->sessionId = sessionId;
 	pMsg->transactionId = 0;