diff mbox

[19/22] zd1211rw: reset device when CR_BCN_FIFO_SEMAPHORE freezes in beacon setup

Message ID 20110131185002.10044.3635.stgit@fate.lan (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

Jussi Kivilinna Jan. 31, 2011, 6:50 p.m. UTC
None
diff mbox

Patch

diff --git a/drivers/net/wireless/zd1211rw/zd_mac.c b/drivers/net/wireless/zd1211rw/zd_mac.c
index a590a94..beaa969 100644
--- a/drivers/net/wireless/zd1211rw/zd_mac.c
+++ b/drivers/net/wireless/zd1211rw/zd_mac.c
@@ -703,7 +703,7 @@  static int zd_mac_config_beacon(struct ieee80211_hw *hw, struct sk_buff *beacon)
 				dev_err(zd_mac_dev(mac),
 						"Giving up beacon config.\n");
 				r = -ETIMEDOUT;
-				goto release_sema;
+				goto reset_device;
 			}
 		}
 		msleep(20);
@@ -770,6 +770,17 @@  out:
 	mutex_unlock(&mac->chip.mutex);
 	kfree(ioreqs);
 	return r;
+
+reset_device:
+	mutex_unlock(&mac->chip.mutex);
+	kfree(ioreqs);
+
+	/* semaphore stuck, reset device to avoid fw freeze later */
+	dev_warn(zd_mac_dev(mac), "CR_BCN_FIFO_SEMAPHORE stuck, "
+				  "reseting device...");
+	usb_queue_reset_device(mac->chip.usb.intf);
+
+	return r;
 }
 
 static int fill_ctrlset(struct zd_mac *mac,