Просмотр исходного кода

qcacld-3.0: Replace typedef tSirLinkSpeedInfo

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 tSirLinkSpeedInfo 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: I36ab84336b9f0290bc68eb5a42678fd49d0f3c51
CRs-Fixed: 2399107
Jeff Johnson 6 лет назад
Родитель
Сommit
e943bca8f9

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

@@ -5433,11 +5433,11 @@ QDF_STATUS wlan_hdd_get_snr(struct hdd_adapter *adapter, int8_t *snr)
 }
 
 struct linkspeed_priv {
-	tSirLinkSpeedInfo linkspeed_info;
+	struct link_speed_info linkspeed_info;
 };
 
 static void
-hdd_get_link_speed_cb(tSirLinkSpeedInfo *linkspeed_info, void *context)
+hdd_get_link_speed_cb(struct link_speed_info *linkspeed_info, void *context)
 {
 	struct osif_request *request;
 	struct linkspeed_priv *priv;
@@ -5466,7 +5466,7 @@ int wlan_hdd_get_linkspeed_for_peermac(struct hdd_adapter *adapter,
 	int ret;
 	QDF_STATUS status;
 	void *cookie;
-	tSirLinkSpeedInfo *linkspeed_info;
+	struct link_speed_info *linkspeed_info;
 	struct osif_request *request;
 	struct linkspeed_priv *priv;
 	static const struct osif_request_params params = {

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

@@ -2670,11 +2670,11 @@ typedef struct sSirChAvoidUpdateReq {
 } tSirChAvoidUpdateReq;
 #endif /* FEATURE_WLAN_CH_AVOID */
 
-typedef struct sSirLinkSpeedInfo {
+struct link_speed_info {
 	/* MAC Address for the peer */
 	struct qdf_mac_addr peer_macaddr;
 	uint32_t estLinkSpeed;  /* Linkspeed from firmware */
-} tSirLinkSpeedInfo, *tpSirLinkSpeedInfo;
+};
 
 /**
  * struct sir_peer_info_req - peer info request struct

+ 15 - 4
core/sme/inc/sme_api.h

@@ -946,11 +946,22 @@ QDF_STATUS sme_init_thermal_info(mac_handle_t mac_handle);
 
 QDF_STATUS sme_set_thermal_level(mac_handle_t mac_handle, uint8_t level);
 QDF_STATUS sme_txpower_limit(mac_handle_t mac_handle, tSirTxPowerLimit *psmetx);
+
+/**
+ * sme_get_link_speed() - Retrieve current link speed
+ * @mac_handle: Global MAC handle
+ * @req: Link speed request structure
+ * @context: User context to be passed back when invoking @cb
+ * @cb: Callback function to be invoked with link speed results
+ *
+ * Return: QDF_STATUS_SUCCESS if the request was accepted, otherwise
+ * an appropriate error status.
+ */
 QDF_STATUS sme_get_link_speed(mac_handle_t mac_handle,
-			      tSirLinkSpeedInfo *lsReq,
-			      void *plsContext,
-			      void (*pCallbackfn)(tSirLinkSpeedInfo *indParam,
-						  void *pContext));
+			      struct link_speed_info *req,
+			      void *context,
+			      sme_link_speed_cb cb);
+
 QDF_STATUS sme_modify_add_ie(mac_handle_t mac_handle,
 		tSirModifyIE *pModifyIE, eUpdateIEsType updateType);
 QDF_STATUS sme_update_add_ie(mac_handle_t mac_handle,

+ 14 - 3
core/sme/inc/sme_internal.h

@@ -129,6 +129,18 @@ typedef void (*link_layer_stats_cb)(hdd_handle_t hdd_handle,
 typedef void (*ext_scan_ind_cb)(hdd_handle_t hdd_handle,
 				const uint16_t, void *);
 
+/**
+ * typedef sme_link_speed_cb - sme_get_link_speed() callback function
+ * @info: link speed information
+ * @context: user context supplied to sme_get_link_speed()
+ *
+ * This is the signature of a callback function whose addresses is
+ * passed as the asynchronous callback function to sme_get_link_speed().
+ */
+
+typedef void (*sme_link_speed_cb)(struct link_speed_info *info,
+				  void *context);
+
 typedef void (*ocb_callback)(void *context, void *response);
 typedef void (*sme_set_thermal_level_callback)(hdd_handle_t hdd_handle,
 					       u_int8_t level);
@@ -273,9 +285,8 @@ typedef struct tagSmeStruct {
 	stats_ext_cb stats_ext_cb;
 	stats_ext2_cb stats_ext2_cb;
 	/* linkspeed callback */
-	void (*pLinkSpeedIndCb)(tSirLinkSpeedInfo *indParam,
-			void *pDevContext);
-	void *pLinkSpeedCbContext;
+	sme_link_speed_cb link_speed_cb;
+	void *link_speed_context;
 	/* get peer info callback */
 	void (*pget_peer_info_ind_cb)(struct sir_peer_info_resp *param,
 		void *pcontext);

+ 9 - 10
core/sme/src/common/sme_api.c

@@ -7237,17 +7237,16 @@ bool sme_is_feature_supported_by_fw(enum cap_bitmap feature)
 	return IS_FEATURE_SUPPORTED_BY_FW(feature);
 }
 
-QDF_STATUS sme_get_link_speed(mac_handle_t mac_handle, tSirLinkSpeedInfo *lsReq,
-			      void *plsContext,
-			      void (*pCallbackfn)(tSirLinkSpeedInfo *indParam,
-						  void *pContext))
+QDF_STATUS sme_get_link_speed(mac_handle_t mac_handle,
+			      struct link_speed_info *req,
+			      void *context,
+			      sme_link_speed_cb cb)
 {
-
-	QDF_STATUS status = QDF_STATUS_SUCCESS;
+	QDF_STATUS status;
 	struct mac_context *mac;
 	void *wma_handle;
 
-	if (!mac_handle || !pCallbackfn || !lsReq) {
+	if (!mac_handle || !cb || !req) {
 		QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR,
 			  FL("Invalid parameter"));
 		return QDF_STATUS_E_FAILURE;
@@ -7267,9 +7266,9 @@ QDF_STATUS sme_get_link_speed(mac_handle_t mac_handle, tSirLinkSpeedInfo *lsReq,
 		return QDF_STATUS_E_FAILURE;
 	}
 
-	mac->sme.pLinkSpeedCbContext = plsContext;
-	mac->sme.pLinkSpeedIndCb = pCallbackfn;
-	status = wma_get_link_speed(wma_handle, lsReq);
+	mac->sme.link_speed_context = context;
+	mac->sme.link_speed_cb = cb;
+	status = wma_get_link_speed(wma_handle, req);
 	sme_release_global_lock(&mac->sme);
 	return status;
 }

+ 2 - 1
core/wma/inc/wma_api.h

@@ -148,7 +148,8 @@ void wma_set_peer_authorized_cb(void *wma_ctx, wma_peer_authorized_fp auth_cb);
 QDF_STATUS wma_set_peer_param(void *wma_ctx, uint8_t *peer_addr,
 		  uint32_t param_id,
 		  uint32_t param_value, uint32_t vdev_id);
-QDF_STATUS wma_get_link_speed(WMA_HANDLE handle, tSirLinkSpeedInfo *pLinkSpeed);
+QDF_STATUS wma_get_link_speed(WMA_HANDLE handle,
+			      struct link_speed_info *pLinkSpeed);
 #ifdef NOT_YET
 QDF_STATUS wma_update_channel_list(WMA_HANDLE handle, void *scan_chan_info);
 #endif

+ 2 - 1
core/wma/src/wma_features.c

@@ -805,7 +805,8 @@ WLAN_PHY_MODE wma_chan_phy_mode(uint8_t chan, enum phy_ch_width chan_width,
  *
  * Return: QDF status
  */
-QDF_STATUS wma_get_link_speed(WMA_HANDLE handle, tSirLinkSpeedInfo *pLinkSpeed)
+QDF_STATUS wma_get_link_speed(WMA_HANDLE handle,
+			      struct link_speed_info *pLinkSpeed)
 {
 	tp_wma_handle wma_handle = (tp_wma_handle) handle;
 	wmi_mac_addr peer_macaddr;

+ 6 - 6
core/wma/src/wma_utils.c

@@ -3470,7 +3470,7 @@ int wma_peer_info_event_handler(void *handle, u_int8_t *cmd_param_info,
 QDF_STATUS wma_send_link_speed(uint32_t link_speed)
 {
 	struct mac_context *mac_ctx;
-	tSirLinkSpeedInfo *ls_ind;
+	struct link_speed_info *ls_ind;
 
 	mac_ctx = cds_get_context(QDF_MODULE_ID_PE);
 	if (!mac_ctx) {
@@ -3478,16 +3478,16 @@ QDF_STATUS wma_send_link_speed(uint32_t link_speed)
 		return QDF_STATUS_E_INVAL;
 	}
 
-	ls_ind = qdf_mem_malloc(sizeof(tSirLinkSpeedInfo));
+	ls_ind = qdf_mem_malloc(sizeof(*ls_ind));
 	if (!ls_ind)
 		return QDF_STATUS_E_NOMEM;
 
 	ls_ind->estLinkSpeed = link_speed;
-	if (mac_ctx->sme.pLinkSpeedIndCb)
-		mac_ctx->sme.pLinkSpeedIndCb(ls_ind,
-				mac_ctx->sme.pLinkSpeedCbContext);
+	if (mac_ctx->sme.link_speed_cb)
+		mac_ctx->sme.link_speed_cb(ls_ind,
+					   mac_ctx->sme.link_speed_context);
 	else
-		WMA_LOGD("%s: pLinkSpeedIndCb is null", __func__);
+		WMA_LOGD("%s: link_speed_cb is null", __func__);
 	qdf_mem_free(ls_ind);
 
 	return QDF_STATUS_SUCCESS;