Skip to contentSkip to conversation

rt2x00: Call all configure handlers during resume

PATCH In review Ivo van Doorn 1 participant 1 message Jul 31, 2007 Networking drivers (wireless)

lore
Share & tools
lore
#0 lore raw

PATCH 16/24 rt2x00: Call all configure handlers during resume

Quoted 1 line

From 4800d5b02a237838913df950e557cf17f2f70dde Mon Sep 17 00:00:00 2001

From: Ivo van Doorn <[email protected]>
Date: Sun, 29 Jul 2007 14:19:31 +0200
Subject: [PATCH 16/24] rt2x00: Call all configure handlers during resume

All configure handlers should be called during resume operation to bring the device back into the correct state to make the device work again.

---
 drivers/net/wireless/rt2x00dev.c |   24 ++++++++++++++++++++++--
 1 files changed, 22 insertions(+), 2 deletions(-)
drivers/net/wireless/rt2x00dev.c +22 -2
index 0220107..4989cdb 100644
@@ -1078,6 +1078,9 @@ EXPORT_SYMBOL_GPL(rt2x00lib_suspend);
 
 int rt2x00lib_resume(struct rt2x00_dev *rt2x00dev)
 {
+	const struct rt2x00lib_ops *lib = rt2x00dev->ops->lib;
+	struct ieee80211_conf *conf = &rt2x00dev->hw->conf;
+	struct interface *intf = &rt2x00dev->interface;
 	int retval;
 
 	NOTICE(rt2x00dev, "Waking up.\n");
@@ -1095,10 +1098,27 @@ int rt2x00lib_resume(struct rt2x00_dev *rt2x00dev)
 		return retval;
 
 	/*
+	 * Configure the device to the original state.
+	 */
+	lib->config_type(rt2x00dev, intf->type);
+	lib->config_promisc(rt2x00dev, test_bit(INTERFACE_ENABLED_PROMISC,
+						&rt2x00dev->flags));
+	lib->config_bssid(rt2x00dev, intf->bssid);
+	lib->config_phymode(rt2x00dev, conf->phymode);
+	lib->config_channel(rt2x00dev, conf->channel_val,
+			    conf->channel, conf->power_level);
+	lib->config_antenna(rt2x00dev, conf->antenna_sel_tx,
+			    conf->antenna_sel_rx);
+	lib->config_duration(rt2x00dev,
+			     (conf->flags & IEEE80211_CONF_SHORT_SLOT_TIME),
+			     conf->beacon_int);
+	lib->reset_tuner(rt2x00dev);
+
+	/*
 	 * We only need to continue when in Master or Ad-hoc mode.
 	 */
-	if (rt2x00dev->interface.type != IEEE80211_IF_TYPE_AP &&
-	    rt2x00dev->interface.type != IEEE80211_IF_TYPE_IBSS)
+	if (intf->type != IEEE80211_IF_TYPE_AP &&
+	    intf->type != IEEE80211_IF_TYPE_IBSS)
 		return 0;
 
 	/*
Signature · 1 line
1.5.2.4