qcacld-3.0: Add HTC Credit History Feature flag

Add compilation flag to compile out HTC credit History
feature cleanly from the cld-3.2 driver binary.

Change-Id: I5f5e73e430d282c99d3077fb82ed1cb8eb79715a
CRs-Fixed: 2190545
diff --git a/Kbuild b/Kbuild
index 34abda0..9c6a78e 100644
--- a/Kbuild
+++ b/Kbuild
@@ -398,6 +398,9 @@
 #Flag to enable Stats Ext implementation
 CONFIG_FEATURE_STATS_EXT := 1
 
+#Flag to enable HTC credit history feature
+CONFIG_FEATURE_HTC_CREDIT_HISTORY := 1
+
 ifeq ($(CONFIG_CFG80211),y)
 HAVE_CFG80211 := 1
 else
@@ -1383,6 +1386,10 @@
             $(WLAN_COMMON_ROOT)/$(HTC_DIR)/htc_recv.o \
             $(WLAN_COMMON_ROOT)/$(HTC_DIR)/htc_services.o
 
+ifeq ($(CONFIG_FEATURE_HTC_CREDIT_HISTORY), 1)
+HTC_OBJS += $(WLAN_COMMON_ROOT)/$(HTC_DIR)/htc_credit_history.o
+endif
+
 ########### HIF ###########
 HIF_DIR := hif
 HIF_CE_DIR := $(HIF_DIR)/src/ce
@@ -1809,6 +1816,10 @@
 endif
 ####################################
 
+ifeq ($(CONFIG_FEATURE_HTC_CREDIT_HISTORY), 1)
+CDEFINES += -DFEATURE_HTC_CREDIT_HISTORY
+endif
+
 ifneq ($(CONFIG_HIF_USB), 1)
 CDEFINES += -DWLAN_LOGGING_SOCK_SVC_ENABLE
 endif
diff --git a/core/cds/inc/cds_api.h b/core/cds/inc/cds_api.h
index f3fe949..95f4ead 100644
--- a/core/cds/inc/cds_api.h
+++ b/core/cds/inc/cds_api.h
@@ -551,11 +551,28 @@
 }
 #endif
 
-#ifdef WMI_INTERFACE_EVENT_LOGGING
-void cds_print_htc_credit_history(uint32_t count, qdf_abstract_print * print,
-				  void *print_priv);
-#endif
+#ifdef FEATURE_HTC_CREDIT_HISTORY
+/**
+ * cds_print_htc_credit_history() - Helper function to copy HTC credit
+ *				    history via htc_print_credit_history()
+ *
+ * @count:	Number of lines to be copied
+ * @print:	Print callback to print in the buffer
+ *
+ * Return:	none
+ */
+void cds_print_htc_credit_history(uint32_t count,
+				qdf_abstract_print * print,
+				void *print_priv);
+#else
 
+static inline
+void cds_print_htc_credit_history(uint32_t count,
+				qdf_abstract_print *print,
+				void *print_priv)
+{
+}
+#endif
 /**
  * cds_is_group_addr() - checks whether addr is multi cast
  * @mac_addr: address to be checked for multicast
diff --git a/core/cds/src/cds_api.c b/core/cds/src/cds_api.c
index 6e3fdf2..2866a84 100644
--- a/core/cds/src/cds_api.c
+++ b/core/cds/src/cds_api.c
@@ -2762,7 +2762,7 @@
 	return con_mode;
 }
 
-#ifdef WMI_INTERFACE_EVENT_LOGGING
+#ifdef FEATURE_HTC_CREDIT_HISTORY
 inline void
 cds_print_htc_credit_history(uint32_t count, qdf_abstract_print *print,
 			     void *print_priv)
diff --git a/core/hdd/src/wlan_hdd_wext.c b/core/hdd/src/wlan_hdd_wext.c
index 7adb478..dc84990 100644
--- a/core/hdd/src/wlan_hdd_wext.c
+++ b/core/hdd/src/wlan_hdd_wext.c
@@ -10604,7 +10604,6 @@
 	return qdf_status_to_os_return(status);
 }
 
-#ifdef WMI_INTERFACE_EVENT_LOGGING
 static int printk_adapter(void *priv, const char *fmt, ...)
 {
 	int ret;
@@ -10624,36 +10623,27 @@
 
 	switch (log_id) {
 	case HTC_CREDIT_HISTORY_LOG:
-		print(NULL, "HTC Credit History (count %u)", count);
 		cds_print_htc_credit_history(count, print, NULL);
 		break;
 	case COMMAND_LOG:
-		print(NULL, "Command Log (count %u)", count);
 		wma_print_wmi_cmd_log(count, print, NULL);
 		break;
 	case COMMAND_TX_CMP_LOG:
-		print(NULL, "Command Tx Complete Log (count %u)", count);
 		wma_print_wmi_cmd_tx_cmp_log(count, print, NULL);
 		break;
 	case MGMT_COMMAND_LOG:
-		print(NULL, "Management Command Log (count %u)", count);
 		wma_print_wmi_mgmt_cmd_log(count, print, NULL);
 		break;
 	case MGMT_COMMAND_TX_CMP_LOG:
-		print(NULL, "Management Command Tx Complete Log (count %u)",
-		      count);
 		wma_print_wmi_mgmt_cmd_tx_cmp_log(count, print, NULL);
 		break;
 	case EVENT_LOG:
-		print(NULL, "Event Log (count %u)", count);
 		wma_print_wmi_event_log(count, print, NULL);
 		break;
 	case RX_EVENT_LOG:
-		print(NULL, "Rx Event Log (count %u)", count);
 		wma_print_wmi_rx_event_log(count, print, NULL);
 		break;
 	case MGMT_EVENT_LOG:
-		print(NULL, "Management Event Log (count %u)", count);
 		wma_print_wmi_mgmt_event_log(count, print, NULL);
 		break;
 	default:
@@ -10661,11 +10651,6 @@
 		break;
 	}
 }
-#else
-static inline void hdd_ioctl_log_buffer(int log_id, uint32_t count)
-{
-}
-#endif /* WMI_INTERFACE_EVENT_LOGGING */
 
 static int __iw_set_two_ints_getnone(struct net_device *dev,
 				     struct iw_request_info *info,
@@ -11998,11 +11983,13 @@
 	 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
 	 0, "crash_inject"}
 	,
+#if defined(WMI_INTERFACE_EVENT_LOGGING) || defined(FEATURE_HTC_CREDIT_HISTORY)
 	{WE_LOG_BUFFER,
 	 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
 	 0, "log_buffer"}
 	,
 #endif
+#endif
 #ifdef WLAN_SUSPEND_RESUME_TEST
 	{WE_SET_WLAN_SUSPEND,
 	 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2,
diff --git a/core/wma/inc/wma.h b/core/wma/inc/wma.h
index fe227d6..28073a9 100644
--- a/core/wma/inc/wma.h
+++ b/core/wma/inc/wma.h
@@ -2500,8 +2500,10 @@
 {
 	t_wma_handle *wma = cds_get_context(QDF_MODULE_ID_WMA);
 
-	if (wma)
+	if (wma) {
+		print(print_priv, "Command Log (count %u)", count);
 		wmi_print_cmd_log(wma->wmi_handle, count, print, print_priv);
+	}
 }
 
 static inline void wma_print_wmi_cmd_tx_cmp_log(uint32_t count,
@@ -2510,9 +2512,11 @@
 {
 	t_wma_handle *wma = cds_get_context(QDF_MODULE_ID_WMA);
 
-	if (wma)
+	if (wma) {
+		print(print_priv, "Command Tx Complete Log (count %u)", count);
 		wmi_print_cmd_tx_cmp_log(wma->wmi_handle, count, print,
 					 print_priv);
+	}
 }
 
 static inline void wma_print_wmi_mgmt_cmd_log(uint32_t count,
@@ -2521,9 +2525,11 @@
 {
 	t_wma_handle *wma = cds_get_context(QDF_MODULE_ID_WMA);
 
-	if (wma)
+	if (wma) {
+		print(print_priv, "Management Command Log (count %u)", count);
 		wmi_print_mgmt_cmd_log(wma->wmi_handle, count, print,
 				       print_priv);
+	}
 }
 
 static inline void wma_print_wmi_mgmt_cmd_tx_cmp_log(uint32_t count,
@@ -2532,9 +2538,12 @@
 {
 	t_wma_handle *wma = cds_get_context(QDF_MODULE_ID_WMA);
 
-	if (wma)
+	if (wma) {
+		print(print_priv,
+		"Management Command Tx Complete Log (count %u)", count);
 		wmi_print_mgmt_cmd_tx_cmp_log(wma->wmi_handle, count, print,
 					      print_priv);
+	}
 }
 
 static inline void wma_print_wmi_event_log(uint32_t count,
@@ -2543,8 +2552,10 @@
 {
 	t_wma_handle *wma = cds_get_context(QDF_MODULE_ID_WMA);
 
-	if (wma)
+	if (wma) {
+		print(print_priv, "Event Log (count %u)", count);
 		wmi_print_event_log(wma->wmi_handle, count, print, print_priv);
+	}
 }
 
 static inline void wma_print_wmi_rx_event_log(uint32_t count,
@@ -2553,9 +2564,11 @@
 {
 	t_wma_handle *wma = cds_get_context(QDF_MODULE_ID_WMA);
 
-	if (wma)
+	if (wma) {
+		print(print_priv, "Rx Event Log (count %u)", count);
 		wmi_print_rx_event_log(wma->wmi_handle, count, print,
 				       print_priv);
+	}
 }
 
 static inline void wma_print_wmi_mgmt_event_log(uint32_t count,
@@ -2564,9 +2577,54 @@
 {
 	t_wma_handle *wma = cds_get_context(QDF_MODULE_ID_WMA);
 
-	if (wma)
+	if (wma) {
+		print(print_priv, "Management Event Log (count %u)", count);
 		wmi_print_mgmt_event_log(wma->wmi_handle, count, print,
 					 print_priv);
+	}
+}
+#else
+
+static inline void wma_print_wmi_cmd_log(uint32_t count,
+					 qdf_abstract_print *print,
+					 void *print_priv)
+{
+}
+
+static inline void wma_print_wmi_cmd_tx_cmp_log(uint32_t count,
+						qdf_abstract_print *print,
+						void *print_priv)
+{
+}
+
+static inline void wma_print_wmi_mgmt_cmd_log(uint32_t count,
+					      qdf_abstract_print *print,
+					      void *print_priv)
+{
+}
+
+static inline void wma_print_wmi_mgmt_cmd_tx_cmp_log(uint32_t count,
+						     qdf_abstract_print *print,
+						     void *print_priv)
+{
+}
+
+static inline void wma_print_wmi_event_log(uint32_t count,
+					   qdf_abstract_print *print,
+					   void *print_priv)
+{
+}
+
+static inline void wma_print_wmi_rx_event_log(uint32_t count,
+					      qdf_abstract_print *print,
+					      void *print_priv)
+{
+}
+
+static inline void wma_print_wmi_mgmt_event_log(uint32_t count,
+						qdf_abstract_print *print,
+						void *print_priv)
+{
 }
 #endif /* WMI_INTERFACE_EVENT_LOGGING */