Browse Source

qcacld-3.0: Replace typedef tSirWifiChannelStats

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 tSirWifiChannelStats typedef
does not meet any of those criteria, so replace it (and the "tp"
variant) with a properly named struct.

In addition the Linux Coding Style frowns upon mixed-case names so
rename the members which are currently not compliant.

Change-Id: I45562da6441fec1af35483d390057a2693e5d02a
CRs-Fixed: 2427173
Jeff Johnson 6 years ago
parent
commit
4ee14f44f6

+ 4 - 4
core/hdd/src/wlan_hdd_debugfs_llstat.c

@@ -223,7 +223,7 @@ void hdd_debugfs_process_radio_stats(struct hdd_adapter *adapter,
 	ssize_t len = 0;
 	uint8_t *buffer;
 	tSirWifiRadioStat *radio_stat = (tpSirWifiRadioStat) data;
-	tSirWifiChannelStats *chan_stat;
+	struct wifi_channel_stats *chan_stat;
 
 	hdd_enter();
 
@@ -272,9 +272,9 @@ void hdd_debugfs_process_radio_stats(struct hdd_adapter *adapter,
 			"\nNum channels: %d", radio_stat->numChannels);
 
 		for (j = 0; j < radio_stat->numChannels; j++) {
-			chan_stat = (tSirWifiChannelStats *)
+			chan_stat = (struct wifi_channel_stats *)
 					((uint8_t *)radio_stat->channels +
-					  (j * sizeof(tSirWifiChannelStats)));
+					  (j * sizeof(struct wifi_channel_stats)));
 
 			buffer += len;
 			ll_stats.len += len;
@@ -285,7 +285,7 @@ void hdd_debugfs_process_radio_stats(struct hdd_adapter *adapter,
 				chan_stat->channel.center_freq,
 				chan_stat->channel.center_freq0,
 				chan_stat->channel.center_freq1,
-				chan_stat->onTime, chan_stat->ccaBusyTime);
+				chan_stat->on_time, chan_stat->cca_busy_time);
 		}
 
 		radio_stat++;

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

@@ -785,7 +785,7 @@ static int hdd_llstats_radio_fill_channels(struct hdd_adapter *adapter,
 					   tSirWifiRadioStat *radiostat,
 					   struct sk_buff *vendor_event)
 {
-	tSirWifiChannelStats *channel_stats;
+	struct wifi_channel_stats *channel_stats;
 	struct nlattr *chlist;
 	struct nlattr *chinfo;
 	int i;
@@ -798,9 +798,9 @@ static int hdd_llstats_radio_fill_channels(struct hdd_adapter *adapter,
 	}
 
 	for (i = 0; i < radiostat->numChannels; i++) {
-		channel_stats = (tSirWifiChannelStats *) ((uint8_t *)
+		channel_stats = (struct wifi_channel_stats *) ((uint8_t *)
 				     radiostat->channels +
-				     (i * sizeof(tSirWifiChannelStats)));
+				     (i * sizeof(struct wifi_channel_stats)));
 
 		chinfo = nla_nest_start(vendor_event, i);
 		if (!chinfo) {
@@ -822,10 +822,10 @@ static int hdd_llstats_radio_fill_channels(struct hdd_adapter *adapter,
 				channel_stats->channel.center_freq1) ||
 		    nla_put_u32(vendor_event,
 				QCA_WLAN_VENDOR_ATTR_LL_STATS_CHANNEL_ON_TIME,
-				channel_stats->onTime) ||
+				channel_stats->on_time) ||
 		    nla_put_u32(vendor_event,
 				QCA_WLAN_VENDOR_ATTR_LL_STATS_CHANNEL_CCA_BUSY_TIME,
-				channel_stats->ccaBusyTime)) {
+				channel_stats->cca_busy_time)) {
 			hdd_err("nla_put failed");
 			return -EINVAL;
 		}
@@ -857,10 +857,10 @@ static int hdd_llstats_post_radio_stats(struct hdd_adapter *adapter,
 	/*
 	 * Allocate a size of 4096 for the Radio stats comprising
 	 * sizeof (tSirWifiRadioStat) + numChannels * sizeof
-	 * (tSirWifiChannelStats).Each channel data is put with an
+	 * (struct wifi_channel_stats).Each channel data is put with an
 	 * NL attribute.The size of 4096 is considered assuming that
 	 * number of channels shall not exceed beyond  60 with the
-	 * sizeof (tSirWifiChannelStats) being 24 bytes.
+	 * sizeof (struct wifi_channel_stats) being 24 bytes.
 	 */
 
 	vendor_event = cfg80211_vendor_cmd_alloc_reply_skb(

+ 12 - 10
core/mac/inc/sir_api.h

@@ -3597,15 +3597,17 @@ struct wifi_rate_info {
 	uint32_t bitrate;
 };
 
-/* channel statistics */
-typedef struct {
-	/* channel */
+/**
+ * struct wifi_channel_stats - channel statistics
+ * @channel: channel for which the stats are applicable
+ * @on_time: msecs the radio is awake
+ * @cca_busy_time: secs the CCA register is busy
+ */
+struct wifi_channel_stats {
 	struct wifi_channel_info channel;
-	/* msecs the radio is awake (32 bits number accruing over time) */
-	uint32_t onTime;
-	/* msecs the CCA register is busy (32 bits number accruing over time) */
-	uint32_t ccaBusyTime;
-} tSirWifiChannelStats, *tpSirWifiChannelStats;
+	uint32_t on_time;
+	uint32_t cca_busy_time;
+};
 
 #define MAX_TPC_LEVELS 64
 /* radio statistics */
@@ -3660,8 +3662,8 @@ typedef struct {
 	uint32_t on_time_host_scan;
 	uint32_t on_time_lpi_scan;
 
-	/* channel statistics tSirWifiChannelStats */
-	tSirWifiChannelStats *channels;
+	/* channel statistics struct wifi_channel_stats */
+	struct wifi_channel_stats *channels;
 } tSirWifiRadioStat, *tpSirWifiRadioStat;
 
 /**

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

@@ -1681,7 +1681,7 @@ static int wma_unified_link_radio_stats_event_handler(void *handle,
 	size_t radio_stats_size, chan_stats_size;
 	size_t link_stats_results_size;
 	tSirWifiRadioStat *rs_results;
-	tSirWifiChannelStats *chn_results;
+	struct wifi_channel_stats *chn_results;
 
 	struct mac_context *mac = cds_get_context(QDF_MODULE_ID_PE);
 
@@ -1725,7 +1725,7 @@ static int wma_unified_link_radio_stats_event_handler(void *handle,
 	}
 
 	radio_stats_size = sizeof(tSirWifiRadioStat);
-	chan_stats_size = sizeof(tSirWifiChannelStats);
+	chan_stats_size = sizeof(struct wifi_channel_stats);
 	if (fixed_param->num_radio >
 		(UINT_MAX - sizeof(*link_stats_results))/radio_stats_size) {
 		WMA_LOGE("excess num_radio %d is leading to int overflow",
@@ -1831,7 +1831,7 @@ static int wma_unified_link_radio_stats_event_handler(void *handle,
 			return -ENOMEM;
 		}
 
-		chn_results = (tSirWifiChannelStats *) &rs_results->channels[0];
+		chn_results = (struct wifi_channel_stats *) &rs_results->channels[0];
 		next_chan_offset = WMI_TLV_HDR_SIZE;
 		WMA_LOGD("Channel Stats Info");
 		for (count = 0; count < radio_stats->num_channels; count++) {