summaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorDavid Woodhouse <dwmw2@infradead.org>2007-12-11 21:23:59 +0100
committerDavid S. Miller <davem@davemloft.net>2008-01-29 00:06:46 +0100
commit301eacbf30e33f461701df91cb250d3fc24c5fe5 (patch)
tree287a89838a0e5a36f390fba615e60bdc75baa037 /drivers/net
parentlibertas: fix debug output in lbs_cmd_copyback() function. (diff)
downloadlinux-301eacbf30e33f461701df91cb250d3fc24c5fe5.tar.xz
linux-301eacbf30e33f461701df91cb250d3fc24c5fe5.zip
libertas: convert CMD_MESH_ACCESS to a direct command
Signed-off-by: David Woodhouse <dwmw2@infradead.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/wireless/libertas/cmd.c28
-rw-r--r--drivers/net/wireless/libertas/cmd.h3
-rw-r--r--drivers/net/wireless/libertas/cmdresp.c5
-rw-r--r--drivers/net/wireless/libertas/hostcmd.h3
-rw-r--r--drivers/net/wireless/libertas/if_usb.c11
-rw-r--r--drivers/net/wireless/libertas/main.c40
6 files changed, 39 insertions, 51 deletions
diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c
index eeb09e05903c..9d621fe7f08a 100644
--- a/drivers/net/wireless/libertas/cmd.c
+++ b/drivers/net/wireless/libertas/cmd.c
@@ -976,27 +976,25 @@ static int lbs_cmd_fwt_access(struct lbs_private *priv,
return 0;
}
-static int lbs_cmd_mesh_access(struct lbs_private *priv,
- struct cmd_ds_command *cmd,
- u16 cmd_action, void *pdata_buf)
+int lbs_mesh_access(struct lbs_private *priv, uint16_t cmd_action,
+ struct cmd_ds_mesh_access *cmd)
{
- struct cmd_ds_mesh_access *mesh_access = &cmd->params.mesh;
+ int ret;
+
lbs_deb_enter_args(LBS_DEB_CMD, "action %d", cmd_action);
- cmd->command = cpu_to_le16(CMD_MESH_ACCESS);
- cmd->size = cpu_to_le16(sizeof(struct cmd_ds_mesh_access) + S_DS_GEN);
- cmd->result = 0;
+ cmd->hdr.command = cpu_to_le16(CMD_MESH_ACCESS);
+ cmd->hdr.size = cpu_to_le16(sizeof(struct cmd_ds_mesh_access) + S_DS_GEN);
+ cmd->hdr.result = 0;
- if (pdata_buf)
- memcpy(mesh_access, pdata_buf, sizeof(*mesh_access));
- else
- memset(mesh_access, 0, sizeof(*mesh_access));
+ cmd->action = cpu_to_le16(cmd_action);
- mesh_access->action = cpu_to_le16(cmd_action);
+ ret = lbs_cmd_with_response(priv, CMD_MESH_ACCESS, (*cmd));
lbs_deb_leave(LBS_DEB_CMD);
- return 0;
+ return ret;
}
+EXPORT_SYMBOL_GPL(lbs_mesh_access);
static int lbs_cmd_bcn_ctrl(struct lbs_private * priv,
struct cmd_ds_command *cmd,
@@ -1486,10 +1484,6 @@ int lbs_prepare_and_send_command(struct lbs_private *priv,
ret = lbs_cmd_fwt_access(priv, cmdptr, cmd_action, pdata_buf);
break;
- case CMD_MESH_ACCESS:
- ret = lbs_cmd_mesh_access(priv, cmdptr, cmd_action, pdata_buf);
- break;
-
case CMD_GET_TSF:
cmdptr->command = cpu_to_le16(CMD_GET_TSF);
cmdptr->size = cpu_to_le16(sizeof(struct cmd_ds_get_tsf) +
diff --git a/drivers/net/wireless/libertas/cmd.h b/drivers/net/wireless/libertas/cmd.h
index b8e5d21329a3..716f25be5b3e 100644
--- a/drivers/net/wireless/libertas/cmd.h
+++ b/drivers/net/wireless/libertas/cmd.h
@@ -24,4 +24,7 @@ int lbs_cmd_copyback(struct lbs_private *priv, unsigned long extra,
int lbs_update_hw_spec(struct lbs_private *priv);
+int lbs_mesh_access(struct lbs_private *priv, uint16_t cmd_action,
+ struct cmd_ds_mesh_access *cmd);
+
#endif /* _LBS_CMD_H */
diff --git a/drivers/net/wireless/libertas/cmdresp.c b/drivers/net/wireless/libertas/cmdresp.c
index b4cd7b79f54f..6ff705b49ddc 100644
--- a/drivers/net/wireless/libertas/cmdresp.c
+++ b/drivers/net/wireless/libertas/cmdresp.c
@@ -653,11 +653,6 @@ static inline int handle_cmd_response(struct lbs_private *priv,
sizeof(resp->params.fwt));
spin_unlock_irqrestore(&priv->driver_lock, flags);
break;
- case CMD_RET(CMD_MESH_ACCESS):
- if (priv->cur_cmd->pdata_buf)
- memcpy(priv->cur_cmd->pdata_buf, &resp->params.mesh,
- sizeof(resp->params.mesh));
- break;
case CMD_RET(CMD_802_11_BEACON_CTRL):
ret = lbs_ret_802_11_bcn_ctrl(priv, resp);
break;
diff --git a/drivers/net/wireless/libertas/hostcmd.h b/drivers/net/wireless/libertas/hostcmd.h
index e5e2106cd5ac..d9b151a28801 100644
--- a/drivers/net/wireless/libertas/hostcmd.h
+++ b/drivers/net/wireless/libertas/hostcmd.h
@@ -623,6 +623,8 @@ struct cmd_ds_fwt_access {
} __attribute__ ((packed));
struct cmd_ds_mesh_access {
+ struct cmd_header hdr;
+
__le16 action;
__le32 data[32]; /* last position reserved */
} __attribute__ ((packed));
@@ -687,7 +689,6 @@ struct cmd_ds_command {
struct cmd_tx_rate_query txrate;
struct cmd_ds_bt_access bt;
struct cmd_ds_fwt_access fwt;
- struct cmd_ds_mesh_access mesh;
struct cmd_ds_get_tsf gettsf;
struct cmd_ds_802_11_subscribe_event subscribe_event;
struct cmd_ds_802_11_beacon_control bcn_ctrl;
diff --git a/drivers/net/wireless/libertas/if_usb.c b/drivers/net/wireless/libertas/if_usb.c
index 5f2d944312a5..a0866efb9647 100644
--- a/drivers/net/wireless/libertas/if_usb.c
+++ b/drivers/net/wireless/libertas/if_usb.c
@@ -990,11 +990,9 @@ static int if_usb_suspend(struct usb_interface *intf, pm_message_t message)
*/
struct cmd_ds_mesh_access mesh_access;
memset(&mesh_access, 0, sizeof(mesh_access));
+
mesh_access.data[0] = cpu_to_le32(1);
- lbs_prepare_and_send_command(priv,
- CMD_MESH_ACCESS,
- CMD_ACT_MESH_SET_AUTOSTART_ENABLED,
- CMD_OPTION_WAITFORRSP, 0, (void *)&mesh_access);
+ lbs_mesh_access(priv, CMD_ACT_MESH_SET_AUTOSTART_ENABLED, &mesh_access);
}
netif_device_detach(cardp->eth_dev);
@@ -1031,10 +1029,7 @@ static int if_usb_resume(struct usb_interface *intf)
struct cmd_ds_mesh_access mesh_access;
memset(&mesh_access, 0, sizeof(mesh_access));
mesh_access.data[0] = cpu_to_le32(0);
- lbs_prepare_and_send_command(priv,
- CMD_MESH_ACCESS,
- CMD_ACT_MESH_SET_AUTOSTART_ENABLED,
- CMD_OPTION_WAITFORRSP, 0, (void *)&mesh_access);
+ lbs_mesh_access(priv, CMD_ACT_MESH_SET_AUTOSTART_ENABLED, &mesh_access);
}
lbs_deb_leave(LBS_DEB_USB);
diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c
index a081b91fb9ba..7f6b3ccef0c2 100644
--- a/drivers/net/wireless/libertas/main.c
+++ b/drivers/net/wireless/libertas/main.c
@@ -217,13 +217,15 @@ u8 lbs_data_rate_to_fw_index(u32 rate)
static ssize_t lbs_anycast_get(struct device *dev,
struct device_attribute *attr, char * buf)
{
+ struct lbs_private *priv = to_net_dev(dev)->priv;
struct cmd_ds_mesh_access mesh_access;
+ int ret;
memset(&mesh_access, 0, sizeof(mesh_access));
- lbs_prepare_and_send_command(to_net_dev(dev)->priv,
- CMD_MESH_ACCESS,
- CMD_ACT_MESH_GET_ANYCAST,
- CMD_OPTION_WAITFORRSP, 0, (void *)&mesh_access);
+
+ ret = lbs_mesh_access(priv, CMD_ACT_MESH_GET_ANYCAST, &mesh_access);
+ if (ret)
+ return ret;
return snprintf(buf, 12, "0x%X\n", le32_to_cpu(mesh_access.data[0]));
}
@@ -234,17 +236,19 @@ static ssize_t lbs_anycast_get(struct device *dev,
static ssize_t lbs_anycast_set(struct device *dev,
struct device_attribute *attr, const char * buf, size_t count)
{
+ struct lbs_private *priv = to_net_dev(dev)->priv;
struct cmd_ds_mesh_access mesh_access;
uint32_t datum;
+ int ret;
memset(&mesh_access, 0, sizeof(mesh_access));
sscanf(buf, "%x", &datum);
mesh_access.data[0] = cpu_to_le32(datum);
- lbs_prepare_and_send_command((to_net_dev(dev))->priv,
- CMD_MESH_ACCESS,
- CMD_ACT_MESH_SET_ANYCAST,
- CMD_OPTION_WAITFORRSP, 0, (void *)&mesh_access);
+ ret = lbs_mesh_access(priv, CMD_ACT_MESH_SET_ANYCAST, &mesh_access);
+ if (ret)
+ return ret;
+
return strlen(buf);
}
@@ -323,14 +327,15 @@ static DEVICE_ATTR(anycast_mask, 0644, lbs_anycast_get, lbs_anycast_set);
static ssize_t lbs_autostart_enabled_get(struct device *dev,
struct device_attribute *attr, char * buf)
{
+ struct lbs_private *priv = to_net_dev(dev)->priv;
struct cmd_ds_mesh_access mesh_access;
+ int ret;
memset(&mesh_access, 0, sizeof(mesh_access));
- lbs_prepare_and_send_command(to_net_dev(dev)->priv,
- CMD_MESH_ACCESS,
- CMD_ACT_MESH_GET_AUTOSTART_ENABLED,
- CMD_OPTION_WAITFORRSP, 0, (void *)&mesh_access);
+ ret = lbs_mesh_access(priv, CMD_ACT_MESH_GET_AUTOSTART_ENABLED, &mesh_access);
+ if (ret)
+ return ret;
return sprintf(buf, "%d\n", le32_to_cpu(mesh_access.data[0]));
}
@@ -346,10 +351,7 @@ static ssize_t lbs_autostart_enabled_set(struct device *dev,
sscanf(buf, "%d", &datum);
mesh_access.data[0] = cpu_to_le32(datum);
- ret = lbs_prepare_and_send_command(priv,
- CMD_MESH_ACCESS,
- CMD_ACT_MESH_SET_AUTOSTART_ENABLED,
- CMD_OPTION_WAITFORRSP, 0, (void *)&mesh_access);
+ ret = lbs_mesh_access(priv, CMD_ACT_MESH_SET_AUTOSTART_ENABLED, &mesh_access);
if (ret == 0)
priv->mesh_autostart_enabled = datum ? 1 : 0;
@@ -866,10 +868,8 @@ static int lbs_setup_firmware(struct lbs_private *priv)
if (priv->mesh_dev) {
memset(&mesh_access, 0, sizeof(mesh_access));
mesh_access.data[0] = cpu_to_le32(0);
- ret = lbs_prepare_and_send_command(priv,
- CMD_MESH_ACCESS,
- CMD_ACT_MESH_SET_AUTOSTART_ENABLED,
- CMD_OPTION_WAITFORRSP, 0, (void *)&mesh_access);
+ ret = lbs_mesh_access(priv, CMD_ACT_MESH_SET_AUTOSTART_ENABLED,
+ &mesh_access);
if (ret) {
ret = -1;
goto done;