mac: exit wait queue before AP Watchdog

Bug: 275542396
Change-Id: I7ecc6d90dffa18f59d2d9186f0fa7edfc8c9cac3
Signed-off-by: Clément Viel <clement.viel@qorvo.com>
diff --git a/mac/ops.c b/mac/ops.c
index 65d7e8a..bfeb3a2 100644
--- a/mac/ops.c
+++ b/mac/ops.c
@@ -24,10 +24,13 @@
 #include <linux/module.h>
 #include <linux/errno.h>
 #include <net/rtnetlink.h>
+#include <linux/jiffies.h>
 
 #include "mcps802154_i.h"
 #include "llhw-ops.h"
 
+#define DW3000_MAX_STOP_WAIT 10000
+
 static int mcps802154_start(struct ieee802154_hw *hw)
 {
 	struct mcps802154_local *local = hw->priv;
@@ -55,6 +58,7 @@
 static void mcps802154_stop(struct ieee802154_hw *hw)
 {
 	struct mcps802154_local *local = hw->priv;
+	int rc;
 
 	ASSERT_RTNL();
 	WARN_ON(!local->started);
@@ -63,7 +67,9 @@
 	mcps802154_ca_stop(local);
 	mutex_unlock(&local->fsm_lock);
 
-	wait_event(local->wq, !local->started);
+	rc = wait_event_timeout(local->wq, !local->started, msecs_to_jiffies(DW3000_MAX_STOP_WAIT));
+	if (!rc)
+		pr_err("%s timeout elapsed, event !local->started = false\n", __func__);
 }
 
 static int mcps802154_xmit_async(struct ieee802154_hw *hw, struct sk_buff *skb)