
We should only send SIOCGIWAP event to notify wpa_supplicant about a lost
link, not to tell it about our disassociation being done. If we send such
event in both cases, this driver will drag wpa_supplicant into an infinite
loop.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
---
 drivers/staging/rt2860/sta/assoc.c |    6 ++++--
 drivers/staging/rt2860/sta_ioctl.c |    6 ++++++
 2 files changed, 10 insertions(+), 2 deletions(-)

-- 
Index: b/drivers/staging/rt2860/sta/assoc.c
===================================================================
--- a/drivers/staging/rt2860/sta/assoc.c	2010-01-05 11:25:22.000000000 +0100
+++ b/drivers/staging/rt2860/sta/assoc.c	2010-01-05 18:09:34.000000000 +0100
@@ -818,10 +818,11 @@ void MlmeDisassocReqAction(struct rt_rtm
 	COPY_MAC_ADDR(pAd->StaCfg.DisassocSta, pDisassocReq->Addr);
 
 	RTMPSetTimer(&pAd->MlmeAux.DisassocTimer, Timeout);	/* in mSec */
-	pAd->Mlme.AssocMachine.CurrState = DISASSOC_WAIT_RSP;
 
-	RtmpOSWrielessEventSend(pAd, SIOCGIWAP, -1, NULL, NULL, 0);
+	pAd->Mlme.AssocMachine.CurrState = DISASSOC_WAIT_RSP;
 
+	if (INFRA_ON(pAd) || ADHOC_ON(pAd))
+		RtmpOSWrielessEventSend(pAd, SIOCGIWAP, -1, NULL, NULL, 0);
 }
 
 /*
Index: b/drivers/staging/rt2860/sta_ioctl.c
===================================================================
--- a/drivers/staging/rt2860/sta_ioctl.c	2010-01-05 11:25:22.000000000 +0100
+++ b/drivers/staging/rt2860/sta_ioctl.c	2010-01-05 12:55:16.000000000 +0100
@@ -602,6 +602,12 @@ int rt_ioctl_siwap(struct net_device *de
 		DBGPRINT(RT_DEBUG_TRACE,
 			 ("MLME busy, reset MLME state machine!\n"));
 	}
+
+	/* No need to set our BSSID if it's not changing */
+	if (!memcmp(pAdapter->CommonCfg.Bssid, ap_addr->sa_data, ETH_ALEN) ||
+	    !memcmp(pAdapter->MlmeAux.Bssid, ap_addr->sa_data, ETH_ALEN))
+		return 0;
+
 	/* tell CNTL state machine to call NdisMSetInformationComplete() after completing */
 	/* this request, because this request is initiated by NDIS. */
 	pAdapter->MlmeAux.CurrReqIsFromNdis = FALSE;
