Commit 5844d12e authored by David Woodhouse's avatar David Woodhouse Committed by David S. Miller

libertas: convert SUBSCRIBE_EVENT to a direct command

Signed-off-by: default avatarDavid Woodhouse <dwmw2@infradead.org>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent f15ebb63
...@@ -327,53 +327,6 @@ int lbs_cmd_802_11_enable_rsn(struct lbs_private *priv, uint16_t cmd_action, ...@@ -327,53 +327,6 @@ int lbs_cmd_802_11_enable_rsn(struct lbs_private *priv, uint16_t cmd_action,
return ret; return ret;
} }
static ssize_t lbs_tlv_size(const u8 *tlv, u16 size)
{
ssize_t pos = 0;
struct mrvlietypesheader *tlv_h;
while (pos < size) {
u16 length;
tlv_h = (struct mrvlietypesheader *) tlv;
if (tlv_h->len == 0)
return pos;
length = le16_to_cpu(tlv_h->len) +
sizeof(struct mrvlietypesheader);
pos += length;
tlv += length;
}
return pos;
}
static void lbs_cmd_802_11_subscribe_event(struct lbs_private *priv,
struct cmd_ds_command *cmd, u16 cmd_action,
void *pdata_buf)
{
struct cmd_ds_802_11_subscribe_event *events =
(struct cmd_ds_802_11_subscribe_event *) pdata_buf;
/* pdata_buf points to a struct cmd_ds_802_11_subscribe_event and room
* for various Marvell TLVs */
lbs_deb_enter(LBS_DEB_CMD);
cmd->size = cpu_to_le16(sizeof(*events)
- sizeof(events->tlv)
+ S_DS_GEN);
cmd->params.subscribe_event.action = cpu_to_le16(cmd_action);
if (cmd_action == CMD_ACT_GET) {
cmd->params.subscribe_event.events = 0;
} else {
ssize_t sz = lbs_tlv_size(events->tlv, sizeof(events->tlv));
cmd->size = cpu_to_le16(le16_to_cpu(cmd->size) + sz);
cmd->params.subscribe_event.events = events->events;
memcpy(cmd->params.subscribe_event.tlv, events->tlv, sz);
}
lbs_deb_leave(LBS_DEB_CMD);
}
static void set_one_wpa_key(struct MrvlIEtype_keyParamSet * pkeyparamset, static void set_one_wpa_key(struct MrvlIEtype_keyParamSet * pkeyparamset,
struct enc_key * pkey) struct enc_key * pkey)
{ {
...@@ -1545,10 +1498,7 @@ int lbs_prepare_and_send_command(struct lbs_private *priv, ...@@ -1545,10 +1498,7 @@ int lbs_prepare_and_send_command(struct lbs_private *priv,
ret = 0; ret = 0;
break; break;
} }
case CMD_802_11_SUBSCRIBE_EVENT:
lbs_cmd_802_11_subscribe_event(priv, cmdptr,
cmd_action, pdata_buf);
break;
case CMD_802_11_PWR_CFG: case CMD_802_11_PWR_CFG:
cmdptr->command = cpu_to_le16(CMD_802_11_PWR_CFG); cmdptr->command = cpu_to_le16(CMD_802_11_PWR_CFG);
cmdptr->size = cmdptr->size =
......
...@@ -389,25 +389,6 @@ static int lbs_ret_802_11_bcn_ctrl(struct lbs_private * priv, ...@@ -389,25 +389,6 @@ static int lbs_ret_802_11_bcn_ctrl(struct lbs_private * priv,
return 0; return 0;
} }
static int lbs_ret_802_11_subscribe_event(struct lbs_private *priv,
struct cmd_ds_command *resp)
{
struct cmd_ds_802_11_subscribe_event *cmd_event =
&resp->params.subscribe_event;
struct cmd_ds_802_11_subscribe_event *dst_event =
(void *)priv->cur_cmd->callback_arg;
lbs_deb_enter(LBS_DEB_CMD);
if (dst_event->action == cpu_to_le16(CMD_ACT_GET)) {
dst_event->events = cmd_event->events;
memcpy(dst_event->tlv, cmd_event->tlv, sizeof(dst_event->tlv));
}
lbs_deb_leave(LBS_DEB_CMD);
return 0;
}
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_header *cmd_response) struct cmd_header *cmd_response)
...@@ -518,9 +499,6 @@ static inline int handle_cmd_response(struct lbs_private *priv, ...@@ -518,9 +499,6 @@ static inline int handle_cmd_response(struct lbs_private *priv,
sizeof(struct cmd_ds_802_11_led_ctrl)); sizeof(struct cmd_ds_802_11_led_ctrl));
spin_unlock_irqrestore(&priv->driver_lock, flags); spin_unlock_irqrestore(&priv->driver_lock, flags);
break; break;
case CMD_RET(CMD_802_11_SUBSCRIBE_EVENT):
ret = lbs_ret_802_11_subscribe_event(priv, resp);
break;
case CMD_RET(CMD_802_11_PWR_CFG): case CMD_RET(CMD_802_11_PWR_CFG):
spin_lock_irqsave(&priv->driver_lock, flags); spin_lock_irqsave(&priv->driver_lock, flags);
......
This diff is collapsed.
...@@ -156,6 +156,8 @@ struct cmd_ds_802_11_reset { ...@@ -156,6 +156,8 @@ struct cmd_ds_802_11_reset {
}; };
struct cmd_ds_802_11_subscribe_event { struct cmd_ds_802_11_subscribe_event {
struct cmd_header hdr;
__le16 action; __le16 action;
__le16 events; __le16 events;
...@@ -164,7 +166,7 @@ struct cmd_ds_802_11_subscribe_event { ...@@ -164,7 +166,7 @@ struct cmd_ds_802_11_subscribe_event {
* 40 bytes. However, future firmware might add additional TLVs, so I * 40 bytes. However, future firmware might add additional TLVs, so I
* bump this up a bit. * bump this up a bit.
*/ */
u8 tlv[128]; uint8_t tlv[128];
}; };
/* /*
...@@ -728,7 +730,6 @@ struct cmd_ds_command { ...@@ -728,7 +730,6 @@ struct cmd_ds_command {
struct cmd_ds_bt_access bt; struct cmd_ds_bt_access bt;
struct cmd_ds_fwt_access fwt; struct cmd_ds_fwt_access fwt;
struct cmd_ds_get_tsf gettsf; struct cmd_ds_get_tsf gettsf;
struct cmd_ds_802_11_subscribe_event subscribe_event;
struct cmd_ds_802_11_beacon_control bcn_ctrl; struct cmd_ds_802_11_beacon_control bcn_ctrl;
} params; } params;
} __attribute__ ((packed)); } __attribute__ ((packed));
......
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