spin_lock_irqsave(&adapter->driver_lock, flags);
- if (addtail) {
+ if (addtail)
list_add_tail(&cmdnode->list, &adapter->cmdpendingq);
- adapter->nr_cmd_pending++;
- } else
+ else
list_add(&cmdnode->list, &adapter->cmdpendingq);
spin_unlock_irqrestore(&adapter->driver_lock, flags);
spin_lock_irqsave(&adapter->driver_lock, flags);
adapter->cur_cmd_retcode = ret;
__lbs_cleanup_and_insert_cmd(priv, adapter->cur_cmd);
- adapter->nr_cmd_pending--;
adapter->cur_cmd = NULL;
spin_unlock_irqrestore(&adapter->driver_lock, flags);
goto done;
lbs_deb_host("invalid response!\n");
adapter->cur_cmd_retcode = -1;
__lbs_cleanup_and_insert_cmd(priv, adapter->cur_cmd);
- adapter->nr_cmd_pending--;
adapter->cur_cmd = NULL;
spin_unlock_irqrestore(&adapter->driver_lock, flags);
ret = -1;
}
__lbs_cleanup_and_insert_cmd(priv, adapter->cur_cmd);
- adapter->nr_cmd_pending--;
adapter->cur_cmd = NULL;
spin_unlock_irqrestore(&adapter->driver_lock, flags);
}
__lbs_cleanup_and_insert_cmd(priv, adapter->cur_cmd);
- adapter->nr_cmd_pending--;
adapter->cur_cmd = NULL;
spin_unlock_irqrestore(&adapter->driver_lock, flags);
if (adapter->cur_cmd) {
/* Clean up and Put current command back to cmdfreeq */
__lbs_cleanup_and_insert_cmd(priv, adapter->cur_cmd);
- adapter->nr_cmd_pending--;
- WARN_ON(adapter->nr_cmd_pending > 128);
adapter->cur_cmd = NULL;
}
spin_unlock_irqrestore(&adapter->driver_lock, flags);
lbs_scan_networks(priv, scan_cfg, 1);
wait_event_interruptible(priv->adapter->cmd_pending,
- priv->adapter->surpriseremoved || !priv->adapter->nr_cmd_pending);
+ priv->adapter->surpriseremoved ||
+ (!priv->adapter->cur_cmd && list_empty(&priv->adapter->cmdpendingq)));
if (priv->adapter->surpriseremoved)
goto out_scan_cfg;
struct list_head cmdpendingq;
wait_queue_head_t cmd_pending;
- u8 nr_cmd_pending;
/* command related variables protected by adapter->driver_lock */
/** Async and Sync Event variables */
/* Wake-up command waiters which can't sleep in
* lbs_prepare_and_send_command
*/
- if (!adapter->nr_cmd_pending)
+ if (!list_empty(&adapter->cmdpendingq))
wake_up_all(&adapter->cmd_pending);
lbs_tx_runqueue(priv);
}
del_timer(&adapter->command_timer);
- adapter->nr_cmd_pending = 0;
wake_up_all(&adapter->cmd_pending);
lbs_deb_leave(LBS_DEB_THREAD);
spin_lock_init(&adapter->driver_lock);
init_waitqueue_head(&adapter->cmd_pending);
- adapter->nr_cmd_pending = 0;
/* Allocate the command buffers */
if (lbs_allocate_cmd_buffer(priv)) {