/* This function gets a free command node if available in command free queue. 
This file contains the handling of command. It prepares command and sends it to firmware when it is ready. */
static struct cmd_ctrl_node * lbs_get_cmd_ctrl_node(struct lbs_private *priv)
/* This function gets a free command node if available in command free queue. 
This file contains the handling of command. It prepares command and sends it to firmware when it is ready. */
static struct cmd_ctrl_node * lbs_get_cmd_ctrl_node(struct lbs_private *priv)
{
	struct cmd_ctrl_node *tempnode;
	unsigned long flags;
	lbs_deb_enter(LBS_DEB_HOST);
	if (!priv)
		return NULL;
	spin_lock_irqsave(&priv->driver_lock, flags);
	if (!list_empty(&priv->cmdfreeq)) {
		tempnode = list_first_entry(&priv->cmdfreeq,
					    struct cmd_ctrl_node, list);
		list_del(&tempnode->list);
	} else {
		lbs_deb_host("GET_CMD_NODE: cmd_ctrl_node is not available\n");
		tempnode = NULL;
	}
	spin_unlock_irqrestore(&priv->driver_lock, flags);
	lbs_deb_leave(LBS_DEB_HOST);
	return tempnode;
}