diff options
author | Dan Williams <dcbw@redhat.com> | 2008-09-09 09:41:51 -0700 |
---|---|---|
committer | Deepak Saxena <dsaxena@laptop.org> | 2008-09-09 09:41:51 -0700 |
commit | 2dfd32b70c58803fbfd73f9dcb0489d1f976535c (patch) | |
tree | 0153569744d49eaeaef2d17841b2f27349bfcf3e | |
parent | 63579b21df15ab743c960e9ef3f9473bf39519f9 (diff) | |
download | lwn-2dfd32b70c58803fbfd73f9dcb0489d1f976535c.tar.gz lwn-2dfd32b70c58803fbfd73f9dcb0489d1f976535c.zip |
If certain commands were in-flight when the card was pulled or the
driver rmmod-ed, cleanup would block on the work queue stopping, but the
work queue was in turn blocked on the current command being canceled,
which didn't happen. Fix that.
Signed-off-by: Dan Williams <dcbw@redhat.com>
Signed-off-by: Deepak Saxena <dsaxena@laptop.org>
-rw-r--r-- | drivers/net/wireless/libertas/main.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c index 87972fb17569..6ccd395d0972 100644 --- a/drivers/net/wireless/libertas/main.c +++ b/drivers/net/wireless/libertas/main.c @@ -1212,7 +1212,13 @@ int lbs_remove_card(struct lbs_private *priv) cancel_delayed_work(&priv->scan_work); cancel_delayed_work(&priv->assoc_work); cancel_work_sync(&priv->mcast_work); + + /* worker thread destruction blocks on the in-flight command which + * should have been cleared already in lbs_stop_card(). + */ + lbs_deb_main("destroying worker thread\n"); destroy_workqueue(priv->work_thread); + lbs_deb_main("done destroying worker thread\n"); if (priv->psmode == LBS802_11POWERMODEMAX_PSP) { priv->psmode = LBS802_11POWERMODECAM; @@ -1324,13 +1330,26 @@ int lbs_stop_card(struct lbs_private *priv) device_remove_file(&dev->dev, &dev_attr_lbs_mesh); } + /* Delete the timeout of the currently processing command */ + del_timer_sync(&priv->command_timer); + /* Flush pending command nodes */ spin_lock_irqsave(&priv->driver_lock, flags); + lbs_deb_main("clearing pending commands\n"); list_for_each_entry(cmdnode, &priv->cmdpendingq, list) { cmdnode->result = -ENOENT; cmdnode->cmdwaitqwoken = 1; wake_up_interruptible(&cmdnode->cmdwait_q); } + + /* Flush the command the card is currently processing */ + if (priv->cur_cmd) { + lbs_deb_main("clearing current command\n"); + priv->cur_cmd->result = -ENOENT; + priv->cur_cmd->cmdwaitqwoken = 1; + wake_up_interruptible(&priv->cur_cmd->cmdwait_q); + } + lbs_deb_main("done clearing commands\n"); spin_unlock_irqrestore(&priv->driver_lock, flags); unregister_netdev(dev); |