Skip to contentSkip to conversation

rt61pci: fix module reloading

PATCH In review Pavel Roskin 2 participants 4 messages Aug 2, 2009 – Aug 4, 2009 Networking drivers (wireless)

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 rt61pci: fix module reloading

Unloading rt61pci can leave the device in such state that reloading rt61pci would fail to reinitialize it. Bogus data would be read from the EEPROM and the RF version won't be recognized.

It appears that unloading rt61pci with power saving enabled would have such effect. To initialize the device properly, SOFT_RESET_CSR should be set to the same value as rt61pci_config_ps() uses to wake up the device.

---
 drivers/net/wireless/rt2x00/rt61pci.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
drivers/net/wireless/rt2x00/rt61pci.c +5 -0
index fb95b8c..e20dd74 100644
@@ -2601,6 +2601,11 @@ static int rt61pci_probe_hw(struct rt2x00_dev *rt2x00dev)
 	int retval;
 
 	/*
+	 * Disable power saving.
+	 */
+	rt2x00pci_register_write(rt2x00dev, SOFT_RESET_CSR, 0x00000007);
+
+	/*
 	 * Allocate eeprom data.
 	 */
 	retval = rt61pci_validate_eeprom(rt2x00dev);
#1 lore raw

PATCH 2/2 rt2x00: cancel all work on disconnect

---
 drivers/net/wireless/rt2x00/rt2x00dev.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
drivers/net/wireless/rt2x00/rt2x00dev.c +6 -0
index 658a63b..b4c696d 100644
@@ -893,6 +893,12 @@ void rt2x00lib_remove_dev(struct rt2x00_dev *rt2x00dev)
 	rt2x00lib_disable_radio(rt2x00dev);
 
 	/*
+	 * Stop all work.
+	 */
+	cancel_work_sync(&rt2x00dev->filter_work);
+	cancel_work_sync(&rt2x00dev->intf_work);
+
+	/*
 	 * Uninitialize device.
 	 */
 	rt2x00lib_uninitialize(rt2x00dev);
Acked-by on v1 2/2
#2 lore raw

Re: [rt2x00-users] [PATCH 2/2] rt2x00: cancel all work on disconnect

Quoted 1 line · Pavel Roskin

Thanks,

Quoted 27 lines
---
 drivers/net/wireless/rt2x00/rt2x00dev.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
drivers/net/wireless/rt2x00/rt2x00dev.c +6 -0
index 658a63b..b4c696d 100644
@@ -893,6 +893,12 @@ void rt2x00lib_remove_dev(struct rt2x00_dev *rt2x00dev)
 	rt2x00lib_disable_radio(rt2x00dev);
 
 	/*
+	 * Stop all work.
+	 */
+	cancel_work_sync(&rt2x00dev->filter_work);
+	cancel_work_sync(&rt2x00dev->intf_work);
+
+	/*
 	 * Uninitialize device.
 	 */
 	rt2x00lib_uninitialize(rt2x00dev);

_______________________________________________
users mailing list
[email protected]
http://rt2x00.serialmonkey.com/mailman/listinfo/users_rt2x00.serialmonkey.com

Acked-by on v1 1/2
#3 lore raw
In reply to Pavel Roskin
Quoted 10 lines · Pavel Roskin

Unloading rt61pci can leave the device in such state that reloading rt61pci would fail to reinitialize it. Bogus data would be read from the EEPROM and the RF version won't be recognized.

It appears that unloading rt61pci with power saving enabled would have such effect. To initialize the device properly, SOFT_RESET_CSR should be set to the same value as rt61pci_config_ps() uses to wake up the device.

I'm not really happy with the patch, but if it works, it works. I got no better alternative to fix this correctly so we might as well merge this into wireless-testing now. :)

Thanks.

Quoted 25 lines
---
 drivers/net/wireless/rt2x00/rt61pci.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
drivers/net/wireless/rt2x00/rt61pci.c +5 -1
index fb95b8c..e20dd74 100644
@@ -2601,6 +2601,11 @@ static int rt61pci_probe_hw(struct rt2x00_dev *rt2x00dev)
 	int retval;
 
 	/*
+	 * Disable power saving.
+	 */
+	rt2x00pci_register_write(rt2x00dev, SOFT_RESET_CSR, 0x00000007);
+
+	/*
 	 * Allocate eeprom data.
 	 */
 	retval = rt61pci_validate_eeprom(rt2x00dev);
--

To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html