[PATCH 04/17] rtl8192e: Add stop function to mac80211 ops

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Mike McCormack <mikem@xxxxxxxxxx>
---
 drivers/staging/rtl8192e/ieee80211/ieee80211.h |    1 +
 drivers/staging/rtl8192e/r8192E_core.c         |   58 +++++++++++------------
 2 files changed, 29 insertions(+), 30 deletions(-)

diff --git a/drivers/staging/rtl8192e/ieee80211/ieee80211.h b/drivers/staging/rtl8192e/ieee80211/ieee80211.h
index d100db9..0b26fbd 100644
--- a/drivers/staging/rtl8192e/ieee80211/ieee80211.h
+++ b/drivers/staging/rtl8192e/ieee80211/ieee80211.h
@@ -1798,6 +1798,7 @@ struct ieee80211_ops {
 	int (*tx)(struct ieee80211_device *hw, struct sk_buff *skb);
 	int (*config)(struct ieee80211_device *hw, u32 changed);
 	int (*start)(struct ieee80211_device *hw);
+	void (*stop)(struct ieee80211_device *hw);
 };
 
 struct ieee80211_device {
diff --git a/drivers/staging/rtl8192e/r8192E_core.c b/drivers/staging/rtl8192e/r8192E_core.c
index 2c27baa..195373c 100644
--- a/drivers/staging/rtl8192e/r8192E_core.c
+++ b/drivers/staging/rtl8192e/r8192E_core.c
@@ -757,16 +757,17 @@ void PHY_SetRtl8192eRfOff(struct r8192_priv *priv)
 	write_nic_byte(priv, ANAPAR_FOR_8192PciE, 0x07);
 }
 
-static void rtl8192_halt_adapter(struct r8192_priv *priv, bool reset)
+static void rtl8192_stop(struct ieee80211_device *ieee)
 {
+	struct r8192_priv *priv = ieee80211_priv(ieee->dev);
 	int i;
 	u8 OpMode;
 	u32 ulRegRead;
 
 	OpMode = RT_OP_MODE_NO_LINK;
-	priv->ieee80211->SetHwRegHandler(priv->ieee80211, HW_VAR_MEDIA_STATUS, &OpMode);
+	ieee->SetHwRegHandler(ieee, HW_VAR_MEDIA_STATUS, &OpMode);
 
-	if (!priv->ieee80211->bSupportRemoteWakeUp) {
+	if (!ieee->bSupportRemoteWakeUp) {
 		/*
 		 * disable tx/rx. In 8185 we write 0x10 (Reset bit),
 		 * but here we make reference to WMAC and wirte 0x0
@@ -774,33 +775,29 @@ static void rtl8192_halt_adapter(struct r8192_priv *priv, bool reset)
 		write_nic_byte(priv, CMDR, 0);
 	}
 
-	mdelay(20);
+	mdelay(170);
 
-	if (!reset) {
-		mdelay(150);
+	priv->bHwRfOffAction = 2;
 
-		priv->bHwRfOffAction = 2;
+	/*
+	 * Call MgntActSet_RF_State instead to
+	 * prevent RF config race condition.
+	 */
+	if (!priv->ieee80211->bSupportRemoteWakeUp) {
+		PHY_SetRtl8192eRfOff(priv);
+		ulRegRead = read_nic_dword(priv, CPU_GEN);
+		ulRegRead |= CPU_GEN_SYSTEM_RESET;
+		write_nic_dword(priv,CPU_GEN, ulRegRead);
+	} else {
+		/* for WOL */
+		write_nic_dword(priv, WFCRC0, 0xffffffff);
+		write_nic_dword(priv, WFCRC1, 0xffffffff);
+		write_nic_dword(priv, WFCRC2, 0xffffffff);
 
-		/*
-		 * Call MgntActSet_RF_State instead to
-		 * prevent RF config race condition.
-		 */
-		if (!priv->ieee80211->bSupportRemoteWakeUp) {
-			PHY_SetRtl8192eRfOff(priv);
-			ulRegRead = read_nic_dword(priv, CPU_GEN);
-			ulRegRead |= CPU_GEN_SYSTEM_RESET;
-			write_nic_dword(priv,CPU_GEN, ulRegRead);
-		} else {
-			/* for WOL */
-			write_nic_dword(priv, WFCRC0, 0xffffffff);
-			write_nic_dword(priv, WFCRC1, 0xffffffff);
-			write_nic_dword(priv, WFCRC2, 0xffffffff);
-
-			/* Write PMR register */
-			write_nic_byte(priv, PMR, 0x5);
-			/* Disable tx, enanble rx */
-			write_nic_byte(priv, MacBlkCtrl, 0xa);
-		}
+		/* Write PMR register */
+		write_nic_byte(priv, PMR, 0x5);
+		/* Disable tx, enanble rx */
+		write_nic_byte(priv, MacBlkCtrl, 0xa);
 	}
 
 	for(i = 0; i < MAX_QUEUE_SIZE; i++) {
@@ -3464,7 +3461,7 @@ int rtl8192_down(struct net_device *dev)
 
 	ieee80211_softmac_stop_protocol(priv->ieee80211,true);
 
-	rtl8192_halt_adapter(priv, false);
+	rtl8192_stop(priv->ieee80211);
 	memset(&priv->ieee80211->current_network, 0 , offsetof(struct ieee80211_network, list));
 
 	RT_TRACE(COMP_DOWN, "<==========%s()\n", __FUNCTION__);
@@ -3481,7 +3478,7 @@ void rtl8192_commit(struct r8192_priv *priv)
 	ieee80211_softmac_stop_protocol(priv->ieee80211,true);
 
 	rtl8192_irq_disable(priv);
-	rtl8192_halt_adapter(priv, true);
+	rtl8192_stop(priv->ieee80211);
 	_rtl8192_up(priv);
 }
 
@@ -4539,6 +4536,7 @@ static const struct ieee80211_ops r8192e_ops = {
 	.tx =				rtl8192_hard_start_xmit,
 	.config = 			rtl8192_config,
 	.start =			rtl8192_start,
+	.stop =				rtl8192_stop,
 };
 
 static int __devinit rtl8192_pci_probe(struct pci_dev *pdev,
@@ -5040,7 +5038,7 @@ bool NicIFDisableNIC(struct r8192_priv *priv)
 	// <2> Stop all timer
 
 	// <3> Disable Adapter
-	rtl8192_halt_adapter(priv, false);
+	rtl8192_stop(priv->ieee80211);
 //	priv->bdisable_nic = true;
 
 	return status;
-- 
1.7.0.4


_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel


[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux