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

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
This diff is collapsed.
......@@ -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,
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;
unsigned long flags;
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)
{
u16 respcmd;
struct cmd_ds_command *resp;
struct cmd_header *resp;
int ret = 0;
ulong flags;
u16 result;
......@@ -692,15 +693,14 @@ int lbs_process_rx_command(struct lbs_private *priv)
spin_unlock_irqrestore(&priv->driver_lock, flags);
goto done;
}
resp = (struct cmd_ds_command *)(priv->cur_cmd->bufvirtualaddr);
resp = priv->cur_cmd->cmdbuf;
respcmd = le16_to_cpu(resp->command);
result = le16_to_cpu(resp->result);
lbs_deb_host("CMD_RESP: response 0x%04x, size %d, jiffies %lu\n",
respcmd, priv->upld_len, jiffies);
lbs_deb_hex(LBS_DEB_HOST, "CMD_RESP", priv->cur_cmd->bufvirtualaddr,
priv->upld_len);
lbs_deb_hex(LBS_DEB_HOST, "CMD_RESP", (void *) resp, priv->upld_len);
if (!(respcmd & 0x8000)) {
lbs_deb_host("invalid response!\n");
......@@ -716,7 +716,7 @@ int lbs_process_rx_command(struct lbs_private *priv)
priv->cur_cmd_retcode = result;
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);
lbs_deb_host(
......@@ -796,7 +796,7 @@ int lbs_process_rx_command(struct lbs_private *priv)
if (priv->cur_cmd && priv->cur_cmd->callback) {
ret = priv->cur_cmd->callback(priv, priv->cur_cmd->callback_arg,
(struct cmd_header *) resp);
resp);
} else
ret = handle_cmd_response(priv, 0, resp);
......
......@@ -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_NUM_OF_CMD_BUFFER 10
#define MRVDRV_SIZE_OF_CMD_BUFFER (2 * 1024)
#define LBS_NUM_CMD_BUFFERS 10
#define LBS_CMD_BUFFER_SIZE (2 * 1024)
#define MRVDRV_MAX_CHANNEL_SIZE 14
#define MRVDRV_ASSOCIATION_TIME_OUT 255
#define MRVDRV_SNAP_HEADER_LEN 8
......
......@@ -81,7 +81,7 @@ struct cmd_ctrl_node {
int (*callback)(struct lbs_private *, unsigned long, struct cmd_header *);
unsigned long callback_arg;
/* command data */
u8 *bufvirtualaddr;
struct cmd_header *cmdbuf;
/* wait queue */
u16 cmdwaitqwoken;
wait_queue_head_t cmdwait_q;
......
......@@ -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);
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);
goto out;
}
......@@ -683,7 +683,7 @@ static int if_cs_get_int_status(struct lbs_private *priv, u8 *ireg)
cmdbuf = priv->upld_buf;
priv->hisregcpy &= ~IF_CS_C_S_RX_UPLD_RDY;
} else {
cmdbuf = priv->cur_cmd->bufvirtualaddr;
cmdbuf = (u8 *) priv->cur_cmd->cmdbuf;
}
ret = if_cs_receive_cmdres(priv, cmdbuf, &priv->upld_len);
......
......@@ -142,14 +142,14 @@ static int if_sdio_handle_cmd(struct if_sdio_card *card,
goto out;
}
if (size > MRVDRV_SIZE_OF_CMD_BUFFER) {
if (size > LBS_CMD_BUFFER_SIZE) {
lbs_deb_sdio("response packet too large (%d bytes)\n",
(int)size);
ret = -E2BIG;
goto out;
}
memcpy(card->priv->cur_cmd->bufvirtualaddr, buffer, size);
memcpy(card->priv->cur_cmd->cmdbuf, buffer, size);
card->priv->upld_len = size;
card->int_cause |= MRVDRV_CMD_UPLD_RDY;
......
......@@ -639,7 +639,7 @@ static inline void process_cmdrequest(int recvlength, u8 *recvbuff,
struct lbs_private *priv)
{
u8 *cmdbuf;
if (recvlength > MRVDRV_SIZE_OF_CMD_BUFFER) {
if (recvlength > LBS_CMD_BUFFER_SIZE) {
lbs_deb_usbd(&cardp->udev->dev,
"The receive buffer is too large\n");
kfree_skb(skb);
......@@ -656,7 +656,7 @@ static inline void process_cmdrequest(int recvlength, u8 *recvbuff,
cmdbuf = priv->upld_buf;
priv->hisregcpy &= ~MRVDRV_CMD_UPLD_RDY;
} else
cmdbuf = priv->cur_cmd->bufvirtualaddr;
cmdbuf = (u8 *) priv->cur_cmd->cmdbuf;
cardp->usb_int_cause |= MRVDRV_CMD_UPLD_RDY;
priv->upld_len = (recvlength - MESSAGE_HEADER_LEN);
......
......@@ -890,23 +890,21 @@ static int lbs_setup_firmware(struct lbs_private *priv)
static void command_timer_fn(unsigned long data)
{
struct lbs_private *priv = (struct lbs_private *)data;
struct cmd_ctrl_node *ptempnode;
struct cmd_ds_command *cmd;
struct cmd_ctrl_node *node;
unsigned long flags;
ptempnode = priv->cur_cmd;
if (ptempnode == NULL) {
node = priv->cur_cmd;
if (node == NULL) {
lbs_deb_fw("ptempnode empty\n");
return;
}
cmd = (struct cmd_ds_command *)ptempnode->bufvirtualaddr;
if (!cmd) {
if (!node->cmdbuf) {
lbs_deb_fw("cmd is NULL\n");
return;
}
lbs_deb_fw("command_timer_fn fired, cmd %x\n", cmd->command);
lbs_deb_fw("command_timer_fn fired, cmd %x\n", node->cmdbuf->command);
if (!priv->fw_ready)
return;
......@@ -916,7 +914,7 @@ static void command_timer_fn(unsigned long data)
spin_unlock_irqrestore(&priv->driver_lock, flags);
lbs_deb_fw("re-sending same command because of timeout\n");
lbs_queue_cmd(priv, ptempnode, 0);
lbs_queue_cmd(priv, node, 0);
wake_up_interruptible(&priv->waitq);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment