wlan: Subsystem restart invoke mutex_lock in atomic environment

When WCTS_NotifyCallback() is invoked in the interrupt context ,to
process SMD_EVENT_CLOSE  event it is trying to get the VOS List
mutex to clear the transfport message queue which is not desirable in
the interrupt context.To fix the issue moved the cleaning of the
transport message queue to wdi_shutdown().

Change-Id: Ieb5e5bb689b3139b3780b97890488894e8b46ee9
CR-Fixed: 401750
diff --git a/CORE/WDI/CP/src/wlan_qct_wdi.c b/CORE/WDI/CP/src/wlan_qct_wdi.c
index f42ed66..4215713 100644
--- a/CORE/WDI/CP/src/wlan_qct_wdi.c
+++ b/CORE/WDI/CP/src/wlan_qct_wdi.c
@@ -1622,7 +1622,12 @@
       /* Close control transport, called from module unload */
       WCTS_CloseTransport(gWDICb.wctsHandle);
    }
-
+   else
+   {
+      /* Riva is crashed then SMD is already closed so cleaning all
+         the pending messages in the transport queue  */
+      WCTS_ClearPendingQueue(gWDICb.wctsHandle);
+   }
    /*destroy the BSS sessions pending Queue */
    for ( i = 0; i < WDI_MAX_BSS_SESSIONS; i++ )
    {
diff --git a/CORE/WDI/TRP/CTS/inc/wlan_qct_wdi_cts.h b/CORE/WDI/TRP/CTS/inc/wlan_qct_wdi_cts.h
index cca2fc0..be37a84 100644
--- a/CORE/WDI/TRP/CTS/inc/wlan_qct_wdi_cts.h
+++ b/CORE/WDI/TRP/CTS/inc/wlan_qct_wdi_cts.h
@@ -235,4 +235,18 @@
   wpt_uint32           uLen
 );
 
+/**
+ @brief    This helper function is used to clean up the pending
+           messages in the transport queue
+
+ @param wctsHandlehandle:  transport handle
+
+ @see
+ @return   0 for success
+*/
+wpt_uint32
+WCTS_ClearPendingQueue
+(
+   WCTS_HandleType      wctsHandle
+);
 #endif /* #ifndef WLAN_QCT_WDI_CTS_H */
diff --git a/CORE/WDI/TRP/CTS/src/wlan_qct_wdi_cts.c b/CORE/WDI/TRP/CTS/src/wlan_qct_wdi_cts.c
index ba826bf..d6bb577 100644
--- a/CORE/WDI/TRP/CTS/src/wlan_qct_wdi_cts.c
+++ b/CORE/WDI/TRP/CTS/src/wlan_qct_wdi_cts.c
@@ -440,7 +440,7 @@
  @see
  @return   0 for success
 */
-static wpt_uint32
+wpt_uint32
 WCTS_ClearPendingQueue
 (
    WCTS_HandleType      wctsHandle
@@ -467,7 +467,6 @@
       wpalMemoryFree(pBuffer);
       wpalMemoryFree(pBufferQueue);
    }
-
    return eWLAN_PAL_STATUS_SUCCESS;
 
 }/*WCTS_ClearPendingQueue*/
@@ -551,7 +550,6 @@
        * this would happen only when Riva crashed and SMD is
        * closing the channel on behalf of Riva */
       pWCTSCb->wctsState = WCTS_STATE_REM_CLOSED;
-      WCTS_ClearPendingQueue (pWCTSCb);
       WPAL_TRACE(eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_INFO,
                  "%s: received SMD_EVENT_CLOSE WLAN driver going down now",
                  __FUNCTION__);