Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d9896ee1 authored by David Woodhouse's avatar David Woodhouse Committed by David S. Miller
Browse files

libertas: rename and clean up DownloadcommandToStation



Call it lbs_submit_command(), remove a bunch of things which can be (or,
in the case of zeroing ->cmdwaitqwoken, already are) done elsewhere.

Signed-off-by: default avatarDavid Woodhouse <dwmw2@infradead.org>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 8e5b6b2d
Loading
Loading
Loading
Loading
+9 −27
Original line number Original line Diff line number Diff line
@@ -1170,6 +1170,10 @@ void lbs_queue_cmd(struct lbs_private *priv,
		lbs_deb_host("QUEUE_CMD: cmdnode or cmdbuf is NULL\n");
		lbs_deb_host("QUEUE_CMD: cmdnode or cmdbuf is NULL\n");
		goto done;
		goto done;
	}
	}
	if (!cmdnode->cmdbuf->size) {
		lbs_deb_host("DNLD_CMD: cmd size is zero\n");
		goto done;
	}


	/* Exit_PS command needs to be queued in the header always. */
	/* Exit_PS command needs to be queued in the header always. */
	if (le16_to_cpu(cmdnode->cmdbuf->command) == CMD_802_11_PS_MODE) {
	if (le16_to_cpu(cmdnode->cmdbuf->command) == CMD_802_11_PS_MODE) {
@@ -1197,14 +1201,7 @@ void lbs_queue_cmd(struct lbs_private *priv,
	lbs_deb_leave(LBS_DEB_HOST);
	lbs_deb_leave(LBS_DEB_HOST);
}
}


/*
static int lbs_submit_command(struct lbs_private *priv,
 * TODO: Fix the issue when DownloadcommandToStation is being called the
 * second time when the command times out. All the cmdptr->xxx are in little
 * endian and therefore all the comparissions will fail.
 * For now - we are not performing the endian conversion the second time - but
 * for PS and DEEP_SLEEP we need to worry
 */
static int DownloadcommandToStation(struct lbs_private *priv,
			      struct cmd_ctrl_node *cmdnode)
			      struct cmd_ctrl_node *cmdnode)
{
{
	unsigned long flags;
	unsigned long flags;
@@ -1215,21 +1212,9 @@ static int DownloadcommandToStation(struct lbs_private *priv,


	lbs_deb_enter(LBS_DEB_HOST);
	lbs_deb_enter(LBS_DEB_HOST);


	if (!priv || !cmdnode) {
		lbs_deb_host("DNLD_CMD: priv or cmdmode is NULL\n");
		goto done;
	}

	cmd = cmdnode->cmdbuf;
	cmd = cmdnode->cmdbuf;


	spin_lock_irqsave(&priv->driver_lock, flags);
	spin_lock_irqsave(&priv->driver_lock, flags);
	if (!cmd || !cmd->size) {
		lbs_deb_host("DNLD_CMD: cmdptr is NULL or zero\n");
		__lbs_cleanup_and_insert_cmd(priv, cmdnode);
		spin_unlock_irqrestore(&priv->driver_lock, flags);
		goto done;
	}

	priv->cur_cmd = cmdnode;
	priv->cur_cmd = cmdnode;
	priv->cur_cmd_retcode = 0;
	priv->cur_cmd_retcode = 0;
	spin_unlock_irqrestore(&priv->driver_lock, flags);
	spin_unlock_irqrestore(&priv->driver_lock, flags);
@@ -1241,12 +1226,9 @@ static int DownloadcommandToStation(struct lbs_private *priv,
		     command, le16_to_cpu(cmd->seqnum), cmdsize, jiffies);
		     command, le16_to_cpu(cmd->seqnum), cmdsize, jiffies);
	lbs_deb_hex(LBS_DEB_HOST, "DNLD_CMD", (void *) cmdnode->cmdbuf, cmdsize);
	lbs_deb_hex(LBS_DEB_HOST, "DNLD_CMD", (void *) cmdnode->cmdbuf, cmdsize);


	cmdnode->cmdwaitqwoken = 0;

	ret = priv->hw_host_to_card(priv, MVMS_CMD, (u8 *) cmd, cmdsize);
	ret = priv->hw_host_to_card(priv, MVMS_CMD, (u8 *) cmd, cmdsize);

	if (ret) {
	if (ret != 0) {
		lbs_pr_info("DNLD_CMD: hw_host_to_card failed: %d\n", ret);
		lbs_deb_host("DNLD_CMD: hw_host_to_card failed\n");
		spin_lock_irqsave(&priv->driver_lock, flags);
		spin_lock_irqsave(&priv->driver_lock, flags);
		priv->cur_cmd_retcode = ret;
		priv->cur_cmd_retcode = ret;
		__lbs_cleanup_and_insert_cmd(priv, priv->cur_cmd);
		__lbs_cleanup_and_insert_cmd(priv, priv->cur_cmd);
@@ -1952,7 +1934,7 @@ int lbs_execute_next_command(struct lbs_private *priv)
		list_del(&cmdnode->list);
		list_del(&cmdnode->list);
		lbs_deb_host("EXEC_NEXT_CMD: sending command 0x%04x\n",
		lbs_deb_host("EXEC_NEXT_CMD: sending command 0x%04x\n",
			    le16_to_cpu(cmd->command));
			    le16_to_cpu(cmd->command));
		DownloadcommandToStation(priv, cmdnode);
		lbs_submit_command(priv, cmdnode);
	} else {
	} else {
		/*
		/*
		 * check if in power save mode, if yes, put the device back
		 * check if in power save mode, if yes, put the device back