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

Commit ddac4526 authored by Dan Williams's avatar Dan Williams Committed by David S. Miller
Browse files

libertas: rename and re-type bufvirtualaddr to cmdbuf



Make it a struct cmd_header, since that's what it is, and clean up
the places that it's used.

Signed-off-by: default avatarDan Williams <dcbw@redhat.com>
Signed-off-by: default avatarDavid Woodhouse <dwmw2@infradead.org>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent c9cd6f9d
Loading
Loading
Loading
Loading
+57 −76
Original line number Original line Diff line number Diff line
@@ -1028,24 +1028,18 @@ void lbs_queue_cmd(struct lbs_private *priv,
	u8 addtail)
	u8 addtail)
{
{
	unsigned long flags;
	unsigned long flags;
	struct cmd_ds_command *cmdptr;


	lbs_deb_enter(LBS_DEB_HOST);
	lbs_deb_enter(LBS_DEB_HOST);


	if (!cmdnode) {
	if (!cmdnode || !cmdnode->cmdbuf) {
		lbs_deb_host("QUEUE_CMD: cmdnode is NULL\n");
		lbs_deb_host("QUEUE_CMD: cmdnode or cmdbuf is NULL\n");
		goto done;
	}

	cmdptr = (struct cmd_ds_command *)cmdnode->bufvirtualaddr;
	if (!cmdptr) {
		lbs_deb_host("QUEUE_CMD: cmdptr is NULL\n");
		goto done;
		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(cmdptr->command) == CMD_802_11_PS_MODE) {
	if (le16_to_cpu(cmdnode->cmdbuf->command) == CMD_802_11_PS_MODE) {
		struct cmd_ds_802_11_ps_mode *psm = &cmdptr->params.psmode;
		struct cmd_ds_802_11_ps_mode *psm = (void *) cmdnode->cmdbuf;

		if (psm->action == cpu_to_le16(CMD_SUBCMD_EXIT_PS)) {
		if (psm->action == cpu_to_le16(CMD_SUBCMD_EXIT_PS)) {
			if (priv->psstate != PS_STATE_FULL_POWER)
			if (priv->psstate != PS_STATE_FULL_POWER)
				addtail = 0;
				addtail = 0;
@@ -1062,7 +1056,7 @@ void lbs_queue_cmd(struct lbs_private *priv,
	spin_unlock_irqrestore(&priv->driver_lock, flags);
	spin_unlock_irqrestore(&priv->driver_lock, flags);


	lbs_deb_host("QUEUE_CMD: inserted command 0x%04x into cmdpendingq\n",
	lbs_deb_host("QUEUE_CMD: inserted command 0x%04x into cmdpendingq\n",
	       le16_to_cpu(((struct cmd_ds_gen*)cmdnode->bufvirtualaddr)->command));
	       le16_to_cpu(cmdnode->cmdbuf->command));


done:
done:
	lbs_deb_leave(LBS_DEB_HOST);
	lbs_deb_leave(LBS_DEB_HOST);
@@ -1079,7 +1073,7 @@ static int DownloadcommandToStation(struct lbs_private *priv,
				    struct cmd_ctrl_node *cmdnode)
				    struct cmd_ctrl_node *cmdnode)
{
{
	unsigned long flags;
	unsigned long flags;
	struct cmd_ds_command *cmdptr;
	struct cmd_header *cmd;
	int ret = -1;
	int ret = -1;
	u16 cmdsize;
	u16 cmdsize;
	u16 command;
	u16 command;
@@ -1091,10 +1085,10 @@ static int DownloadcommandToStation(struct lbs_private *priv,
		goto done;
		goto done;
	}
	}


	cmdptr = (struct cmd_ds_command *)cmdnode->bufvirtualaddr;
	cmd = cmdnode->cmdbuf;


	spin_lock_irqsave(&priv->driver_lock, flags);
	spin_lock_irqsave(&priv->driver_lock, flags);
	if (!cmdptr || !cmdptr->size) {
	if (!cmd || !cmd->size) {
		lbs_deb_host("DNLD_CMD: cmdptr is NULL or zero\n");
		lbs_deb_host("DNLD_CMD: cmdptr is NULL or zero\n");
		__lbs_cleanup_and_insert_cmd(priv, cmdnode);
		__lbs_cleanup_and_insert_cmd(priv, cmdnode);
		spin_unlock_irqrestore(&priv->driver_lock, flags);
		spin_unlock_irqrestore(&priv->driver_lock, flags);
@@ -1105,16 +1099,16 @@ static int DownloadcommandToStation(struct lbs_private *priv,
	priv->cur_cmd_retcode = 0;
	priv->cur_cmd_retcode = 0;
	spin_unlock_irqrestore(&priv->driver_lock, flags);
	spin_unlock_irqrestore(&priv->driver_lock, flags);


	cmdsize = le16_to_cpu(cmdptr->size);
	cmdsize = le16_to_cpu(cmd->size);
	command = le16_to_cpu(cmdptr->command);
	command = le16_to_cpu(cmd->command);


	lbs_deb_host("DNLD_CMD: command 0x%04x, size %d, jiffies %lu\n",
	lbs_deb_host("DNLD_CMD: command 0x%04x, size %d, jiffies %lu\n",
		    command, cmdsize, jiffies);
		    command, cmdsize, jiffies);
	lbs_deb_hex(LBS_DEB_HOST, "DNLD_CMD", cmdnode->bufvirtualaddr, cmdsize);
	lbs_deb_hex(LBS_DEB_HOST, "DNLD_CMD", (void *) cmdnode->cmdbuf, cmdsize);


	cmdnode->cmdwaitqwoken = 0;
	cmdnode->cmdwaitqwoken = 0;


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


	if (ret != 0) {
	if (ret != 0) {
		lbs_deb_host("DNLD_CMD: hw_host_to_card failed\n");
		lbs_deb_host("DNLD_CMD: hw_host_to_card failed\n");
@@ -1265,7 +1259,7 @@ int lbs_prepare_and_send_command(struct lbs_private *priv,


	lbs_set_cmd_ctrl_node(priv, cmdnode, wait_option, pdata_buf);
	lbs_set_cmd_ctrl_node(priv, cmdnode, wait_option, pdata_buf);


	cmdptr = (struct cmd_ds_command *)cmdnode->bufvirtualaddr;
	cmdptr = (struct cmd_ds_command *)cmdnode->cmdbuf;


	lbs_deb_host("PREP_CMD: command 0x%04x\n", cmd_no);
	lbs_deb_host("PREP_CMD: command 0x%04x\n", cmd_no);


@@ -1556,41 +1550,35 @@ EXPORT_SYMBOL_GPL(lbs_prepare_and_send_command);
int lbs_allocate_cmd_buffer(struct lbs_private *priv)
int lbs_allocate_cmd_buffer(struct lbs_private *priv)
{
{
	int ret = 0;
	int ret = 0;
	u32 ulbufsize;
	u32 bufsize;
	u32 i;
	u32 i;
	struct cmd_ctrl_node *tempcmd_array;
	struct cmd_ctrl_node *cmdarray;
	u8 *ptempvirtualaddr;


	lbs_deb_enter(LBS_DEB_HOST);
	lbs_deb_enter(LBS_DEB_HOST);


	/* Allocate and initialize cmdCtrlNode */
	/* Allocate and initialize the command array */
	ulbufsize = sizeof(struct cmd_ctrl_node) * MRVDRV_NUM_OF_CMD_BUFFER;
	bufsize = sizeof(struct cmd_ctrl_node) * LBS_NUM_CMD_BUFFERS;

	if (!(cmdarray = kzalloc(bufsize, GFP_KERNEL))) {
	if (!(tempcmd_array = kzalloc(ulbufsize, GFP_KERNEL))) {
		lbs_deb_host("ALLOC_CMD_BUF: tempcmd_array is NULL\n");
		lbs_deb_host("ALLOC_CMD_BUF: tempcmd_array is NULL\n");
		ret = -1;
		ret = -1;
		goto done;
		goto done;
	}
	}
	priv->cmd_array = tempcmd_array;
	priv->cmd_array = cmdarray;


	/* Allocate and initialize command buffers */
	/* Allocate and initialize each command buffer in the command array */
	ulbufsize = MRVDRV_SIZE_OF_CMD_BUFFER;
	for (i = 0; i < LBS_NUM_CMD_BUFFERS; i++) {
	for (i = 0; i < MRVDRV_NUM_OF_CMD_BUFFER; i++) {
		cmdarray[i].cmdbuf = kzalloc(LBS_CMD_BUFFER_SIZE, GFP_KERNEL);
		if (!(ptempvirtualaddr = kzalloc(ulbufsize, GFP_KERNEL))) {
		if (!cmdarray[i].cmdbuf) {
			lbs_deb_host("ALLOC_CMD_BUF: ptempvirtualaddr is NULL\n");
			lbs_deb_host("ALLOC_CMD_BUF: ptempvirtualaddr is NULL\n");
			ret = -1;
			ret = -1;
			goto done;
			goto done;
		}
		}

		/* Update command buffer virtual */
		tempcmd_array[i].bufvirtualaddr = ptempvirtualaddr;
	}
	}


	for (i = 0; i < MRVDRV_NUM_OF_CMD_BUFFER; i++) {
	for (i = 0; i < LBS_NUM_CMD_BUFFERS; i++) {
		init_waitqueue_head(&tempcmd_array[i].cmdwait_q);
		init_waitqueue_head(&cmdarray[i].cmdwait_q);
		lbs_cleanup_and_insert_cmd(priv, &tempcmd_array[i]);
		lbs_cleanup_and_insert_cmd(priv, &cmdarray[i]);
	}
	}

	ret = 0;
	ret = 0;


done:
done:
@@ -1606,9 +1594,8 @@ int lbs_allocate_cmd_buffer(struct lbs_private *priv)
 */
 */
int lbs_free_cmd_buffer(struct lbs_private *priv)
int lbs_free_cmd_buffer(struct lbs_private *priv)
{
{
	u32 ulbufsize; /* Someone needs to die for this. Slowly and painfully */
	struct cmd_ctrl_node *cmdarray;
	unsigned int i;
	unsigned int i;
	struct cmd_ctrl_node *tempcmd_array;


	lbs_deb_enter(LBS_DEB_HOST);
	lbs_deb_enter(LBS_DEB_HOST);


@@ -1618,14 +1605,13 @@ int lbs_free_cmd_buffer(struct lbs_private *priv)
		goto done;
		goto done;
	}
	}


	tempcmd_array = priv->cmd_array;
	cmdarray = priv->cmd_array;


	/* Release shared memory buffers */
	/* Release shared memory buffers */
	ulbufsize = MRVDRV_SIZE_OF_CMD_BUFFER;
	for (i = 0; i < LBS_NUM_CMD_BUFFERS; i++) {
	for (i = 0; i < MRVDRV_NUM_OF_CMD_BUFFER; i++) {
		if (cmdarray[i].cmdbuf) {
		if (tempcmd_array[i].bufvirtualaddr) {
			kfree(cmdarray[i].cmdbuf);
			kfree(tempcmd_array[i].bufvirtualaddr);
			cmdarray[i].cmdbuf = NULL;
			tempcmd_array[i].bufvirtualaddr = NULL;
		}
		}
	}
	}


@@ -1683,21 +1669,21 @@ struct cmd_ctrl_node *lbs_get_cmd_ctrl_node(struct lbs_private *priv)
 *  @param ptempnode	A pointer to cmdCtrlNode structure
 *  @param ptempnode	A pointer to cmdCtrlNode structure
 *  @return 		n/a
 *  @return 		n/a
 */
 */
static void cleanup_cmdnode(struct cmd_ctrl_node *ptempnode)
static void cleanup_cmdnode(struct cmd_ctrl_node *cmdnode)
{
{
	lbs_deb_enter(LBS_DEB_HOST);
	lbs_deb_enter(LBS_DEB_HOST);


	if (!ptempnode)
	if (!cmdnode)
		return;
		return;
	ptempnode->cmdwaitqwoken = 1;
	cmdnode->cmdwaitqwoken = 1;
	wake_up_interruptible(&ptempnode->cmdwait_q);
	wake_up_interruptible(&cmdnode->cmdwait_q);
	ptempnode->wait_option = 0;
	cmdnode->wait_option = 0;
	ptempnode->pdata_buf = NULL;
	cmdnode->pdata_buf = NULL;
	ptempnode->callback = NULL;
	cmdnode->callback = NULL;
	ptempnode->callback_arg = 0;
	cmdnode->callback_arg = 0;


	if (ptempnode->bufvirtualaddr != NULL)
	if (cmdnode->cmdbuf != NULL)
		memset(ptempnode->bufvirtualaddr, 0, MRVDRV_SIZE_OF_CMD_BUFFER);
		memset(cmdnode->cmdbuf, 0, LBS_CMD_BUFFER_SIZE);


	lbs_deb_leave(LBS_DEB_HOST);
	lbs_deb_leave(LBS_DEB_HOST);
}
}
@@ -1739,7 +1725,7 @@ void lbs_set_cmd_ctrl_node(struct lbs_private *priv,
int lbs_execute_next_command(struct lbs_private *priv)
int lbs_execute_next_command(struct lbs_private *priv)
{
{
	struct cmd_ctrl_node *cmdnode = NULL;
	struct cmd_ctrl_node *cmdnode = NULL;
	struct cmd_ds_command *cmdptr;
	struct cmd_header *cmd;
	unsigned long flags;
	unsigned long flags;
	int ret = 0;
	int ret = 0;


@@ -1765,22 +1751,21 @@ int lbs_execute_next_command(struct lbs_private *priv)
	spin_unlock_irqrestore(&priv->driver_lock, flags);
	spin_unlock_irqrestore(&priv->driver_lock, flags);


	if (cmdnode) {
	if (cmdnode) {
		cmdptr = (struct cmd_ds_command *)cmdnode->bufvirtualaddr;
		cmd = cmdnode->cmdbuf;


		if (is_command_allowed_in_ps(le16_to_cpu(cmdptr->command))) {
		if (is_command_allowed_in_ps(le16_to_cpu(cmd->command))) {
			if ((priv->psstate == PS_STATE_SLEEP) ||
			if ((priv->psstate == PS_STATE_SLEEP) ||
			    (priv->psstate == PS_STATE_PRE_SLEEP)) {
			    (priv->psstate == PS_STATE_PRE_SLEEP)) {
				lbs_deb_host(
				lbs_deb_host(
				       "EXEC_NEXT_CMD: cannot send cmd 0x%04x in psstate %d\n",
				       "EXEC_NEXT_CMD: cannot send cmd 0x%04x in psstate %d\n",
				       le16_to_cpu(cmdptr->command),
				       le16_to_cpu(cmd->command),
				       priv->psstate);
				       priv->psstate);
				ret = -1;
				ret = -1;
				goto done;
				goto done;
			}
			}
			lbs_deb_host("EXEC_NEXT_CMD: OK to send command "
			lbs_deb_host("EXEC_NEXT_CMD: OK to send command "
				     "0x%04x in psstate %d\n",
				     "0x%04x in psstate %d\n",
				    le16_to_cpu(cmdptr->command),
				     le16_to_cpu(cmd->command), priv->psstate);
				    priv->psstate);
		} else if (priv->psstate != PS_STATE_FULL_POWER) {
		} else if (priv->psstate != PS_STATE_FULL_POWER) {
			/*
			/*
			 * 1. Non-PS command:
			 * 1. Non-PS command:
@@ -1793,8 +1778,7 @@ int lbs_execute_next_command(struct lbs_private *priv)
			 * otherwise send this command down to firmware
			 * otherwise send this command down to firmware
			 * immediately.
			 * immediately.
			 */
			 */
			if (cmdptr->command !=
			if (cmd->command != cpu_to_le16(CMD_802_11_PS_MODE)) {
			    cpu_to_le16(CMD_802_11_PS_MODE)) {
				/*  Prepare to send Exit PS,
				/*  Prepare to send Exit PS,
				 *  this non PS command will be sent later */
				 *  this non PS command will be sent later */
				if ((priv->psstate == PS_STATE_SLEEP)
				if ((priv->psstate == PS_STATE_SLEEP)
@@ -1813,8 +1797,7 @@ int lbs_execute_next_command(struct lbs_private *priv)
				 * PS command. Ignore it if it is not Exit_PS.
				 * PS command. Ignore it if it is not Exit_PS.
				 * otherwise send it down immediately.
				 * otherwise send it down immediately.
				 */
				 */
				struct cmd_ds_802_11_ps_mode *psm =
				struct cmd_ds_802_11_ps_mode *psm = (void *)cmd;
				    &cmdptr->params.psmode;


				lbs_deb_host(
				lbs_deb_host(
				       "EXEC_NEXT_CMD: PS cmd, action 0x%02x\n",
				       "EXEC_NEXT_CMD: PS cmd, action 0x%02x\n",
@@ -1848,7 +1831,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(cmdptr->command));
			    le16_to_cpu(cmd->command));
		DownloadcommandToStation(priv, cmdnode);
		DownloadcommandToStation(priv, cmdnode);
	} else {
	} else {
		/*
		/*
@@ -2079,7 +2062,6 @@ int __lbs_cmd(struct lbs_private *priv, uint16_t command,
	      unsigned long callback_arg)
	      unsigned long callback_arg)
{
{
	struct cmd_ctrl_node *cmdnode;
	struct cmd_ctrl_node *cmdnode;
	struct cmd_header *send_cmd;
	unsigned long flags;
	unsigned long flags;
	int ret = 0;
	int ret = 0;


@@ -2107,20 +2089,19 @@ int __lbs_cmd(struct lbs_private *priv, uint16_t command,
		goto done;
		goto done;
	}
	}


	send_cmd = (struct cmd_header *) cmdnode->bufvirtualaddr;
	cmdnode->wait_option = CMD_OPTION_WAITFORRSP;
	cmdnode->wait_option = CMD_OPTION_WAITFORRSP;
	cmdnode->callback = callback;
	cmdnode->callback = callback;
	cmdnode->callback_arg = callback_arg;
	cmdnode->callback_arg = callback_arg;


	/* Copy the incoming command to the buffer */
	/* Copy the incoming command to the buffer */
	memcpy(send_cmd, in_cmd, in_cmd_size);
	memcpy(cmdnode->cmdbuf, in_cmd, in_cmd_size);


	/* Set sequence number, clean result, move to buffer */
	/* Set sequence number, clean result, move to buffer */
	priv->seqnum++;
	priv->seqnum++;
	send_cmd->command = cpu_to_le16(command);
	cmdnode->cmdbuf->command = cpu_to_le16(command);
	send_cmd->size    = cpu_to_le16(in_cmd_size);
	cmdnode->cmdbuf->size    = cpu_to_le16(in_cmd_size);
	send_cmd->seqnum  = cpu_to_le16(priv->seqnum);
	cmdnode->cmdbuf->seqnum  = cpu_to_le16(priv->seqnum);
	send_cmd->result  = 0;
	cmdnode->cmdbuf->result  = 0;


	lbs_deb_host("PREP_CMD: command 0x%04x\n", command);
	lbs_deb_host("PREP_CMD: command 0x%04x\n", command);


+7 −7
Original line number Original line Diff line number Diff line
@@ -491,8 +491,9 @@ static int lbs_ret_802_11_subscribe_event(struct lbs_private *priv,


static inline int handle_cmd_response(struct lbs_private *priv,
static inline int handle_cmd_response(struct lbs_private *priv,
				      unsigned long dummy,
				      unsigned long dummy,
				      struct cmd_ds_command *resp)
				      struct cmd_header *cmd_response)
{
{
	struct cmd_ds_command *resp = (struct cmd_ds_command *) cmd_response;
	int ret = 0;
	int ret = 0;
	unsigned long flags;
	unsigned long flags;
	uint16_t respcmd = le16_to_cpu(resp->command);
	uint16_t respcmd = le16_to_cpu(resp->command);
@@ -673,7 +674,7 @@ static inline int handle_cmd_response(struct lbs_private *priv,
int lbs_process_rx_command(struct lbs_private *priv)
int lbs_process_rx_command(struct lbs_private *priv)
{
{
	u16 respcmd;
	u16 respcmd;
	struct cmd_ds_command *resp;
	struct cmd_header *resp;
	int ret = 0;
	int ret = 0;
	ulong flags;
	ulong flags;
	u16 result;
	u16 result;
@@ -692,15 +693,14 @@ int lbs_process_rx_command(struct lbs_private *priv)
		spin_unlock_irqrestore(&priv->driver_lock, flags);
		spin_unlock_irqrestore(&priv->driver_lock, flags);
		goto done;
		goto done;
	}
	}
	resp = (struct cmd_ds_command *)(priv->cur_cmd->bufvirtualaddr);
	resp = priv->cur_cmd->cmdbuf;


	respcmd = le16_to_cpu(resp->command);
	respcmd = le16_to_cpu(resp->command);
	result = le16_to_cpu(resp->result);
	result = le16_to_cpu(resp->result);


	lbs_deb_host("CMD_RESP: response 0x%04x, size %d, jiffies %lu\n",
	lbs_deb_host("CMD_RESP: response 0x%04x, size %d, jiffies %lu\n",
		respcmd, priv->upld_len, jiffies);
		respcmd, priv->upld_len, jiffies);
	lbs_deb_hex(LBS_DEB_HOST, "CMD_RESP", priv->cur_cmd->bufvirtualaddr,
	lbs_deb_hex(LBS_DEB_HOST, "CMD_RESP", (void *) resp, priv->upld_len);
		    priv->upld_len);


	if (!(respcmd & 0x8000)) {
	if (!(respcmd & 0x8000)) {
		lbs_deb_host("invalid response!\n");
		lbs_deb_host("invalid response!\n");
@@ -716,7 +716,7 @@ int lbs_process_rx_command(struct lbs_private *priv)
	priv->cur_cmd_retcode = result;
	priv->cur_cmd_retcode = result;


	if (respcmd == CMD_RET(CMD_802_11_PS_MODE)) {
	if (respcmd == CMD_RET(CMD_802_11_PS_MODE)) {
		struct cmd_ds_802_11_ps_mode *psmode = &resp->params.psmode;
		struct cmd_ds_802_11_ps_mode *psmode = (void *) resp;
		u16 action = le16_to_cpu(psmode->action);
		u16 action = le16_to_cpu(psmode->action);


		lbs_deb_host(
		lbs_deb_host(
@@ -796,7 +796,7 @@ int lbs_process_rx_command(struct lbs_private *priv)


	if (priv->cur_cmd && priv->cur_cmd->callback) {
	if (priv->cur_cmd && priv->cur_cmd->callback) {
		ret = priv->cur_cmd->callback(priv, priv->cur_cmd->callback_arg,
		ret = priv->cur_cmd->callback(priv, priv->cur_cmd->callback_arg,
				(struct cmd_header *) resp);
				resp);
	} else
	} else
		ret = handle_cmd_response(priv, 0, resp);
		ret = handle_cmd_response(priv, 0, resp);


+2 −2
Original line number Original line Diff line number Diff line
@@ -132,8 +132,8 @@ static inline void lbs_deb_hex(unsigned int grp, const char *prompt, u8 *buf, in
*/
*/


#define MRVDRV_MAX_MULTICAST_LIST_SIZE	32
#define MRVDRV_MAX_MULTICAST_LIST_SIZE	32
#define MRVDRV_NUM_OF_CMD_BUFFER        10
#define LBS_NUM_CMD_BUFFERS             10
#define MRVDRV_SIZE_OF_CMD_BUFFER       (2 * 1024)
#define LBS_CMD_BUFFER_SIZE             (2 * 1024)
#define MRVDRV_MAX_CHANNEL_SIZE		14
#define MRVDRV_MAX_CHANNEL_SIZE		14
#define MRVDRV_ASSOCIATION_TIME_OUT	255
#define MRVDRV_ASSOCIATION_TIME_OUT	255
#define MRVDRV_SNAP_HEADER_LEN          8
#define MRVDRV_SNAP_HEADER_LEN          8
+1 −1
Original line number Original line Diff line number Diff line
@@ -81,7 +81,7 @@ struct cmd_ctrl_node {
	int (*callback)(struct lbs_private *, unsigned long, struct cmd_header *);
	int (*callback)(struct lbs_private *, unsigned long, struct cmd_header *);
	unsigned long callback_arg;
	unsigned long callback_arg;
	/* command data */
	/* command data */
	u8 *bufvirtualaddr;
	struct cmd_header *cmdbuf;
	/* wait queue */
	/* wait queue */
	u16 cmdwaitqwoken;
	u16 cmdwaitqwoken;
	wait_queue_head_t cmdwait_q;
	wait_queue_head_t cmdwait_q;
+2 −2
Original line number Original line Diff line number Diff line
@@ -364,7 +364,7 @@ static int if_cs_receive_cmdres(struct lbs_private *priv, u8 *data, u32 *len)
	}
	}


	*len = if_cs_read16(priv->card, IF_CS_C_CMD_LEN);
	*len = if_cs_read16(priv->card, IF_CS_C_CMD_LEN);
	if ((*len == 0) || (*len > MRVDRV_SIZE_OF_CMD_BUFFER)) {
	if ((*len == 0) || (*len > LBS_CMD_BUFFER_SIZE)) {
		lbs_pr_err("card cmd buffer has invalid # of bytes (%d)\n", *len);
		lbs_pr_err("card cmd buffer has invalid # of bytes (%d)\n", *len);
		goto out;
		goto out;
	}
	}
@@ -683,7 +683,7 @@ static int if_cs_get_int_status(struct lbs_private *priv, u8 *ireg)
			cmdbuf = priv->upld_buf;
			cmdbuf = priv->upld_buf;
			priv->hisregcpy &= ~IF_CS_C_S_RX_UPLD_RDY;
			priv->hisregcpy &= ~IF_CS_C_S_RX_UPLD_RDY;
		} else {
		} else {
			cmdbuf = priv->cur_cmd->bufvirtualaddr;
			cmdbuf = (u8 *) priv->cur_cmd->cmdbuf;
		}
		}


		ret = if_cs_receive_cmdres(priv, cmdbuf, &priv->upld_len);
		ret = if_cs_receive_cmdres(priv, cmdbuf, &priv->upld_len);
Loading