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, ...@@ -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, ...@@ -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) ...@@ -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) ...@@ -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) ...@@ -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);
......
...@@ -132,8 +132,8 @@ static inline void lbs_deb_hex(unsigned int grp, const char *prompt, u8 *buf, in ...@@ -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
......
...@@ -81,7 +81,7 @@ struct cmd_ctrl_node { ...@@ -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;
......
...@@ -364,7 +364,7 @@ static int if_cs_receive_cmdres(struct lbs_private *priv, u8 *data, u32 *len) ...@@ -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) ...@@ -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);
......
...@@ -142,14 +142,14 @@ static int if_sdio_handle_cmd(struct if_sdio_card *card, ...@@ -142,14 +142,14 @@ static int if_sdio_handle_cmd(struct if_sdio_card *card,
goto out; 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", lbs_deb_sdio("response packet too large (%d bytes)\n",
(int)size); (int)size);
ret = -E2BIG; ret = -E2BIG;
goto out; goto out;
} }
memcpy(card->priv->cur_cmd->bufvirtualaddr, buffer, size); memcpy(card->priv->cur_cmd->cmdbuf, buffer, size);
card->priv->upld_len = size; card->priv->upld_len = size;
card->int_cause |= MRVDRV_CMD_UPLD_RDY; card->int_cause |= MRVDRV_CMD_UPLD_RDY;
......
...@@ -639,7 +639,7 @@ static inline void process_cmdrequest(int recvlength, u8 *recvbuff, ...@@ -639,7 +639,7 @@ static inline void process_cmdrequest(int recvlength, u8 *recvbuff,
struct lbs_private *priv) struct lbs_private *priv)
{ {
u8 *cmdbuf; u8 *cmdbuf;
if (recvlength > MRVDRV_SIZE_OF_CMD_BUFFER) { if (recvlength > LBS_CMD_BUFFER_SIZE) {
lbs_deb_usbd(&cardp->udev->dev, lbs_deb_usbd(&cardp->udev->dev,
"The receive buffer is too large\n"); "The receive buffer is too large\n");
kfree_skb(skb); kfree_skb(skb);
...@@ -656,7 +656,7 @@ static inline void process_cmdrequest(int recvlength, u8 *recvbuff, ...@@ -656,7 +656,7 @@ static inline void process_cmdrequest(int recvlength, u8 *recvbuff,
cmdbuf = priv->upld_buf; cmdbuf = priv->upld_buf;
priv->hisregcpy &= ~MRVDRV_CMD_UPLD_RDY; priv->hisregcpy &= ~MRVDRV_CMD_UPLD_RDY;
} else } else
cmdbuf = priv->cur_cmd->bufvirtualaddr; cmdbuf = (u8 *) priv->cur_cmd->cmdbuf;
cardp->usb_int_cause |= MRVDRV_CMD_UPLD_RDY; cardp->usb_int_cause |= MRVDRV_CMD_UPLD_RDY;
priv->upld_len = (recvlength - MESSAGE_HEADER_LEN); priv->upld_len = (recvlength - MESSAGE_HEADER_LEN);
......
...@@ -890,23 +890,21 @@ static int lbs_setup_firmware(struct lbs_private *priv) ...@@ -890,23 +890,21 @@ static int lbs_setup_firmware(struct lbs_private *priv)
static void command_timer_fn(unsigned long data) static void command_timer_fn(unsigned long data)
{ {
struct lbs_private *priv = (struct lbs_private *)data; struct lbs_private *priv = (struct lbs_private *)data;
struct cmd_ctrl_node *ptempnode; struct cmd_ctrl_node *node;
struct cmd_ds_command *cmd;
unsigned long flags; unsigned long flags;
ptempnode = priv->cur_cmd; node = priv->cur_cmd;
if (ptempnode == NULL) { if (node == NULL) {
lbs_deb_fw("ptempnode empty\n"); lbs_deb_fw("ptempnode empty\n");
return; return;
} }
cmd = (struct cmd_ds_command *)ptempnode->bufvirtualaddr; if (!node->cmdbuf) {
if (!cmd) {
lbs_deb_fw("cmd is NULL\n"); lbs_deb_fw("cmd is NULL\n");
return; 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) if (!priv->fw_ready)
return; return;
...@@ -916,7 +914,7 @@ static void command_timer_fn(unsigned long data) ...@@ -916,7 +914,7 @@ static void command_timer_fn(unsigned long data)
spin_unlock_irqrestore(&priv->driver_lock, flags); spin_unlock_irqrestore(&priv->driver_lock, flags);
lbs_deb_fw("re-sending same command because of timeout\n"); 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); 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