qcacld-3.0: Power offload unit test framework enhancements

Recently host power offload suspend/resume has switched to 3
stage process. Enhance power offload unit test framework accordingly,
and improve error handling.

Change-Id: I8cc1e955fbaca631ee7fd76b0c907d1e68c836bf
CRs-Fixed: 1072423
diff --git a/core/hdd/src/wlan_hdd_wext.c b/core/hdd/src/wlan_hdd_wext.c
index 9992c4b..397bdcd 100644
--- a/core/hdd/src/wlan_hdd_wext.c
+++ b/core/hdd/src/wlan_hdd_wext.c
@@ -92,6 +92,7 @@
 #ifdef WLAN_SUSPEND_RESUME_TEST
 #include "wlan_hdd_driver_ops.h"
 #include "hif.h"
+#include "pld_common.h"
 #endif
 
 #define HDD_FINISH_ULA_TIME_OUT         800
@@ -439,10 +440,9 @@
 #define WE_ENABLE_FW_PROFILE    4
 #define WE_SET_FW_PROFILE_HIST_INTVL    5
 
-#ifdef WLAN_SUSPEND_RESUME_TEST
+/* Private sub-ioctl for initiating WoW suspend without Apps suspend */
 #define WE_SET_WLAN_SUSPEND    6
 #define WE_SET_WLAN_RESUME    7
-#endif
 
 /* (SIOCIWFIRSTPRIV + 29) is currently unused */
 
@@ -9782,25 +9782,6 @@
 	return qdf_status_to_os_return(status);
 }
 
-#ifdef WLAN_SUSPEND_RESUME_TEST
-static void *g_wiphy;
-
-/**
- * hdd_wlan_trigger_resume() - resume wlan
- * @val: interrupt val
- *
- * Resume wlan after getting very 1st CE interrupt from target
- *
- * Return: none
- */
-static void hdd_wlan_trigger_resume(uint32_t val)
-{
-	hdd_err("Resume WLAN val 0x%x", val);
-	wlan_hdd_bus_resume();
-	wlan_hdd_cfg80211_resume_wlan(g_wiphy);
-}
-#endif
-
 static int __iw_set_two_ints_getnone(struct net_device *dev,
 				     struct iw_request_info *info,
 				     union iwreq_data *wrqu, char *extra)
@@ -9810,10 +9791,6 @@
 	int sub_cmd = value[0];
 	int ret;
 	hdd_context_t *hdd_ctx = WLAN_HDD_GET_CTX(pAdapter);
-#ifdef WLAN_SUSPEND_RESUME_TEST
-	pm_message_t state;
-#endif
-
 
 	ENTER_DEV(dev);
 
@@ -9877,21 +9854,12 @@
 	case WE_SET_MON_MODE_CHAN:
 		ret = wlan_hdd_set_mon_chan(pAdapter, value[1], value[2]);
 		break;
-#ifdef WLAN_SUSPEND_RESUME_TEST
 	case WE_SET_WLAN_SUSPEND:
-		hdd_err("Suspend WLAN");
-		g_wiphy = hdd_ctx->wiphy;
-		state.event = PM_EVENT_SUSPEND;
-		ret = wlan_hdd_cfg80211_suspend_wlan(hdd_ctx->wiphy, NULL);
-		wlan_hdd_bus_suspend(state);
-		hif_fake_apps_suspend(hdd_wlan_trigger_resume);
+		ret = hdd_wlan_fake_apps_suspend(hdd_ctx->wiphy);
 		break;
 	case WE_SET_WLAN_RESUME:
-		hdd_err("Resume WLAN");
-		wlan_hdd_bus_resume();
-		ret = wlan_hdd_cfg80211_resume_wlan(hdd_ctx->wiphy);
+		ret = hdd_wlan_fake_apps_resume(hdd_ctx->wiphy);
 		break;
-#endif
 	default:
 		hdd_err("Invalid IOCTL command %d", sub_cmd);
 		break;