Prechádzať zdrojové kódy

qcacmn: Replace use of WLAN_OPEN_SOURCE

Currently the DebugFS logic in utils/fwlog/dbglog_host.c is protected
by the flag WLAN_OPEN_SOURCE. The WLAN_OPEN_SOURCE flag is a legacy
flag which had a specific use that is no longer valid. So replace the
use of WLAN_OPEN_SOURCE with a feature-specific flag.

Change-Id: I82c51efff8dfe6673c6b9d956f974cae2d21bb69
CRs-Fixed: 3464911
Jeff Johnson 2 rokov pred
rodič
commit
4612e27f35
2 zmenil súbory, kde vykonal 29 pridanie a 38 odobranie
  1. 25 34
      utils/fwlog/dbglog_host.c
  2. 4 4
      wmi/inc/wmi_unified_priv.h

+ 25 - 34
utils/fwlog/dbglog_host.c

@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2013-2021 The Linux Foundation. All rights reserved.
- * 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
@@ -33,9 +33,9 @@
 #include <linux/netlink.h>
 #include <linux/vmalloc.h>
 
-#ifdef WLAN_OPEN_SOURCE
+#ifdef WLAN_DBGLOG_DEBUGFS
 #include <linux/debugfs.h>
-#endif /* WLAN_OPEN_SOURCE */
+#endif /* WLAN_DBGLOG_DEBUGFS */
 #include "wmi_unified_priv.h"
 
 #ifdef CNSS_GENL
@@ -1560,7 +1560,7 @@ skip_args_processing:
 
 }
 
-#ifdef WLAN_OPEN_SOURCE
+#ifdef WLAN_DBGLOG_DEBUGFS
 static int
 dbglog_debugfs_raw_data(wmi_unified_t wmi_handle, const uint8_t *buf,
 			uint32_t length, uint32_t dropped)
@@ -1605,7 +1605,7 @@ dbglog_debugfs_raw_data(wmi_unified_t wmi_handle, const uint8_t *buf,
 
 	return true;
 }
-#endif /* WLAN_OPEN_SOURCE */
+#endif /* WLAN_DBGLOG_DEBUGFS */
 
 /**
  * nl_srv_bcast_fw_logs() - Wrapper func to send bcast msgs to FW logs mcast grp
@@ -1626,10 +1626,10 @@ static int nl_srv_bcast_fw_logs(struct sk_buff *skb)
 }
 
 /**
- * send_fw_diag_nl_data - pack the data from fw diag event handler
+ * send_fw_diag_nl_data() - pack the data from fw diag event handler
  * @buffer:	buffer of diag event
  * @len:	length of the diag event
- * @event:	the even type
+ * @event_type:	the event type
  *
  * return: 0 if sent successfully, otherwise error code
  */
@@ -1937,7 +1937,7 @@ static int diag_fw_handler(ol_scn_t scn, uint8_t *data, uint32_t datalen)
 		return send_diag_netlink_data((uint8_t *) datap,
 					      len, DIAG_TYPE_FW_MSG);
 	}
-#ifdef WLAN_OPEN_SOURCE
+#ifdef WLAN_DBGLOG_DEBUGFS
 	if (dbglog_process_type == DBGLOG_PROCESS_POOL_RAW) {
 		if (!gprint_limiter) {
 			AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
@@ -1946,7 +1946,7 @@ static int diag_fw_handler(ol_scn_t scn, uint8_t *data, uint32_t datalen)
 		}
 		return 0;
 	}
-#endif /* WLAN_OPEN_SOURCE */
+#endif /* WLAN_DBGLOG_DEBUGFS */
 	if (!gprint_limiter) {
 		AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
 				("NOT Supported only supports net link socket\n"));
@@ -2045,13 +2045,13 @@ int dbglog_parse_debug_logs(ol_scn_t scn, uint8_t *data, uint32_t datalen)
 						   (uint8_t *) buffer,
 						   len, dropped);
 	}
-#ifdef WLAN_OPEN_SOURCE
+#ifdef WLAN_DBGLOG_DEBUGFS
 	if (dbglog_process_type == DBGLOG_PROCESS_POOL_RAW) {
 		return dbglog_debugfs_raw_data((wmi_unified_t) wma->wmi_handle,
 					       (uint8_t *) buffer, len,
 					       dropped);
 	}
-#endif /* WLAN_OPEN_SOURCE */
+#endif /* WLAN_DBGLOG_DEBUGFS */
 
 	while ((count + 2) < length) {
 		timestamp = DBGLOG_GET_TIME_STAMP(buffer[count]);
@@ -4040,7 +4040,7 @@ dbglog_pcielp_print_handler(uint32_t mod_id,
 	return true;
 }
 
-#ifdef WLAN_OPEN_SOURCE
+#ifdef WLAN_DBGLOG_DEBUGFS
 static int dbglog_block_open(struct inode *inode, struct file *file)
 {
 	struct fwdebug *fwlog = inode->i_private;
@@ -4136,11 +4136,13 @@ static const struct file_operations fops_dbglog_block = {
 	.llseek = default_llseek,
 };
 
-#ifdef WLAN_DEBUGFS
-
 static void dbglog_debugfs_init(wmi_unified_t wmi_handle)
 {
 
+	/* Initialize the fw debug log queue */
+	skb_queue_head_init(&wmi_handle->dbglog.fwlog_queue);
+	init_completion(&wmi_handle->dbglog.fwlog_completion);
+
 	wmi_handle->debugfs_phy = qdf_debugfs_create_dir(CLD_DEBUGFS_DIR, NULL);
 	if (!wmi_handle->debugfs_phy) {
 		qdf_print("Failed to create WMI debug fs");
@@ -4156,6 +4158,10 @@ static void dbglog_debugfs_init(wmi_unified_t wmi_handle)
 
 static void dbglog_debugfs_remove(wmi_unified_t wmi_handle)
 {
+	/* DeInitialize the fw debug log queue */
+	skb_queue_purge(&wmi_handle->dbglog.fwlog_queue);
+	complete(&wmi_handle->dbglog.fwlog_completion);
+
 	qdf_debugfs_remove_dir_recursive(wmi_handle->debugfs_phy);
 }
 
@@ -4169,9 +4175,7 @@ static void dbglog_debugfs_remove(wmi_unified_t wmi_handle)
 {
 }
 
-#endif /* End of WLAN_DEBUGFS */
-
-#endif /* WLAN_OPEN_SOURCE */
+#endif /* WLAN_DBGLOG_DEBUGFS */
 
 /**
  * cnss_diag_handle_crash_inject() - API to handle crash inject command
@@ -4281,15 +4285,13 @@ int cnss_diag_deactivate_service(void)
 #else
 
 /**
- *  brief cnss_diag_msg_callback() - Call back invoked by netlink service
+ *  cnss_diag_msg_callback() - Call back invoked by netlink service
+ *  @skb: skb with netlink message
  *
  *  This function gets invoked by netlink service when a message is received
  *  from the cnss-diag application in user-space.
  *
- *  param -
- *     - skb - skb with netlink message
- *
- *  return - 0 for success, non zero for failure
+ *  Return: 0 for success, non zero for failure
  */
 static int cnss_diag_msg_callback(struct sk_buff *skb)
 {
@@ -4533,14 +4535,8 @@ int dbglog_init(wmi_unified_t wmi_handle)
 	if (QDF_IS_STATUS_ERROR(res))
 		return A_ERROR;
 
-#ifdef WLAN_OPEN_SOURCE
-	/* Initialize the fw debug log queue */
-	skb_queue_head_init(&wmi_handle->dbglog.fwlog_queue);
-	init_completion(&wmi_handle->dbglog.fwlog_completion);
-
 	/* Initialize debugfs */
 	dbglog_debugfs_init(wmi_handle);
-#endif /* WLAN_OPEN_SOURCE */
 
 	return A_OK;
 }
@@ -4549,14 +4545,9 @@ int dbglog_deinit(wmi_unified_t wmi_handle)
 {
 	QDF_STATUS res;
 
-#ifdef WLAN_OPEN_SOURCE
-	/* DeInitialize the fw debug log queue */
-	skb_queue_purge(&wmi_handle->dbglog.fwlog_queue);
-	complete(&wmi_handle->dbglog.fwlog_completion);
-
 	/* Deinitialize the debugfs */
 	dbglog_debugfs_remove(wmi_handle);
-#endif /* WLAN_OPEN_SOURCE */
+
 	tgt_assert_enable = 0;
 	res =
 		wmi_unified_unregister_event_handler(wmi_handle,

+ 4 - 4
wmi/inc/wmi_unified_priv.h

@@ -371,13 +371,13 @@ enum WMI_RECORD_TYPE {
 
 #endif /*WMI_INTERFACE_EVENT_LOGGING */
 
-#ifdef WLAN_OPEN_SOURCE
+#ifdef WLAN_DBGLOG_DEBUGFS
 struct fwdebug {
 	struct sk_buff_head fwlog_queue;
 	struct completion fwlog_completion;
 	A_BOOL fwlog_open;
 };
-#endif /* WLAN_OPEN_SOURCE */
+#endif /* WLAN_DBGLOG_DEBUGFS */
 
 /**
  * struct wmi_wq_dbg_info - WMI WQ debug info
@@ -3362,10 +3362,10 @@ struct wmi_unified {
 	struct wmi_host_abi_version final_abi_vers;
 	uint32_t num_of_diag_events_logs;
 	uint32_t *events_logs_list;
-#ifdef WLAN_OPEN_SOURCE
+#ifdef WLAN_DBGLOG_DEBUGFS
 	struct fwdebug dbglog;
 	struct dentry *debugfs_phy;
-#endif /* WLAN_OPEN_SOURCE */
+#endif /* WLAN_DBGLOG_DEBUGFS */
 
 #ifdef WMI_INTERFACE_EVENT_LOGGING
 	struct wmi_debug_log_info log_info;