Commit 689442dc authored by David Woodhouse's avatar David Woodhouse Committed by David S. Miller

libertas: switch lbs_cmd() to take a _pointer_ to the command structure

This way, it looks more like a normal function.
Signed-off-by: default avatarDavid Woodhouse <dwmw2@infradead.org>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 6ce4fd2a
...@@ -56,7 +56,7 @@ int lbs_update_hw_spec(struct lbs_private *priv) ...@@ -56,7 +56,7 @@ int lbs_update_hw_spec(struct lbs_private *priv)
memset(&cmd, 0, sizeof(cmd)); memset(&cmd, 0, sizeof(cmd));
cmd.hdr.size = cpu_to_le16(sizeof(cmd)); cmd.hdr.size = cpu_to_le16(sizeof(cmd));
memcpy(cmd.permanentaddr, priv->current_addr, ETH_ALEN); memcpy(cmd.permanentaddr, priv->current_addr, ETH_ALEN);
ret = lbs_cmd_with_response(priv, CMD_GET_HW_SPEC, cmd); ret = lbs_cmd_with_response(priv, CMD_GET_HW_SPEC, &cmd);
if (ret) if (ret)
goto out; goto out;
...@@ -121,7 +121,7 @@ int lbs_host_sleep_cfg(struct lbs_private *priv, uint32_t criteria, ...@@ -121,7 +121,7 @@ int lbs_host_sleep_cfg(struct lbs_private *priv, uint32_t criteria,
cmd_config.gpio = gpio; cmd_config.gpio = gpio;
cmd_config.gap = gap; cmd_config.gap = gap;
ret = lbs_cmd_with_response(priv, CMD_802_11_HOST_SLEEP_CFG, cmd_config); ret = lbs_cmd_with_response(priv, CMD_802_11_HOST_SLEEP_CFG, &cmd_config);
if (ret) { if (ret) {
lbs_pr_info("HOST_SLEEP_CFG failed %d\n", ret); lbs_pr_info("HOST_SLEEP_CFG failed %d\n", ret);
return ret; return ret;
...@@ -743,7 +743,7 @@ int lbs_get_data_rate(struct lbs_private *priv) ...@@ -743,7 +743,7 @@ int lbs_get_data_rate(struct lbs_private *priv)
cmd.hdr.size = cpu_to_le16(sizeof(cmd)); cmd.hdr.size = cpu_to_le16(sizeof(cmd));
cmd.action = cpu_to_le16(CMD_ACT_GET_TX_RATE); cmd.action = cpu_to_le16(CMD_ACT_GET_TX_RATE);
ret = lbs_cmd_with_response(priv, CMD_802_11_DATA_RATE, cmd); ret = lbs_cmd_with_response(priv, CMD_802_11_DATA_RATE, &cmd);
if (ret) if (ret)
goto out; goto out;
...@@ -790,7 +790,7 @@ int lbs_set_data_rate(struct lbs_private *priv, u8 rate) ...@@ -790,7 +790,7 @@ int lbs_set_data_rate(struct lbs_private *priv, u8 rate)
lbs_deb_cmd("DATA_RATE: setting auto\n"); lbs_deb_cmd("DATA_RATE: setting auto\n");
} }
ret = lbs_cmd_with_response(priv, CMD_802_11_DATA_RATE, cmd); ret = lbs_cmd_with_response(priv, CMD_802_11_DATA_RATE, &cmd);
if (ret) if (ret)
goto out; goto out;
...@@ -846,7 +846,7 @@ int lbs_get_channel(struct lbs_private *priv) ...@@ -846,7 +846,7 @@ int lbs_get_channel(struct lbs_private *priv)
cmd.hdr.size = cpu_to_le16(sizeof(cmd)); cmd.hdr.size = cpu_to_le16(sizeof(cmd));
cmd.action = cpu_to_le16(CMD_OPT_802_11_RF_CHANNEL_GET); cmd.action = cpu_to_le16(CMD_OPT_802_11_RF_CHANNEL_GET);
ret = lbs_cmd_with_response(priv, CMD_802_11_RF_CHANNEL, cmd); ret = lbs_cmd_with_response(priv, CMD_802_11_RF_CHANNEL, &cmd);
if (ret) if (ret)
goto out; goto out;
...@@ -878,7 +878,7 @@ int lbs_set_channel(struct lbs_private *priv, u8 channel) ...@@ -878,7 +878,7 @@ int lbs_set_channel(struct lbs_private *priv, u8 channel)
cmd.action = cpu_to_le16(CMD_OPT_802_11_RF_CHANNEL_SET); cmd.action = cpu_to_le16(CMD_OPT_802_11_RF_CHANNEL_SET);
cmd.channel = cpu_to_le16(channel); cmd.channel = cpu_to_le16(channel);
ret = lbs_cmd_with_response(priv, CMD_802_11_RF_CHANNEL, cmd); ret = lbs_cmd_with_response(priv, CMD_802_11_RF_CHANNEL, &cmd);
if (ret) if (ret)
goto out; goto out;
...@@ -1105,7 +1105,7 @@ int lbs_mesh_access(struct lbs_private *priv, uint16_t cmd_action, ...@@ -1105,7 +1105,7 @@ int lbs_mesh_access(struct lbs_private *priv, uint16_t cmd_action,
cmd->action = cpu_to_le16(cmd_action); cmd->action = cpu_to_le16(cmd_action);
ret = lbs_cmd_with_response(priv, CMD_MESH_ACCESS, (*cmd)); ret = lbs_cmd_with_response(priv, CMD_MESH_ACCESS, cmd);
lbs_deb_leave(LBS_DEB_CMD); lbs_deb_leave(LBS_DEB_CMD);
return ret; return ret;
...@@ -1128,7 +1128,7 @@ int lbs_mesh_config(struct lbs_private *priv, int enable) ...@@ -1128,7 +1128,7 @@ int lbs_mesh_config(struct lbs_private *priv, int enable)
lbs_deb_cmd("mesh config channel %d SSID %s\n", lbs_deb_cmd("mesh config channel %d SSID %s\n",
priv->curbssparams.channel, priv->curbssparams.channel,
escape_essid(priv->mesh_ssid, priv->mesh_ssid_len)); escape_essid(priv->mesh_ssid, priv->mesh_ssid_len));
return lbs_cmd_with_response(priv, CMD_MESH_CONFIG, cmd); return lbs_cmd_with_response(priv, CMD_MESH_CONFIG, &cmd);
} }
static int lbs_cmd_bcn_ctrl(struct lbs_private * priv, static int lbs_cmd_bcn_ctrl(struct lbs_private * priv,
...@@ -2160,6 +2160,7 @@ int lbs_cmd_copyback(struct lbs_private *priv, unsigned long extra, ...@@ -2160,6 +2160,7 @@ int lbs_cmd_copyback(struct lbs_private *priv, unsigned long extra,
lbs_deb_leave(LBS_DEB_CMD); lbs_deb_leave(LBS_DEB_CMD);
return 0; return 0;
} }
EXPORT_SYMBOL_GPL(lbs_cmd_copyback);
/** /**
* @brief Simple way to call firmware functions * @brief Simple way to call firmware functions
......
...@@ -6,13 +6,11 @@ ...@@ -6,13 +6,11 @@
#include "hostcmd.h" #include "hostcmd.h"
#include "dev.h" #include "dev.h"
#define lbs_cmd(priv, cmdnr, cmd, callback, callback_arg) \ #define lbs_cmd(priv, cmdnr, cmd, cb, cb_arg) \
__lbs_cmd(priv, cmdnr, &(cmd).hdr, sizeof(cmd), \ __lbs_cmd(priv, cmdnr, &(cmd)->hdr, sizeof(*(cmd)), cb, cb_arg)
callback, callback_arg)
#define lbs_cmd_with_response(priv, cmdnr, cmd) \ #define lbs_cmd_with_response(priv, cmdnr, cmd) \
__lbs_cmd(priv, cmdnr, &(cmd).hdr, sizeof(cmd), \ lbs_cmd(priv, cmdnr, cmd, lbs_cmd_copyback, (unsigned long) (cmd))
lbs_cmd_copyback, (unsigned long) &cmd)
int __lbs_cmd(struct lbs_private *priv, uint16_t command, int __lbs_cmd(struct lbs_private *priv, uint16_t command,
struct cmd_header *in_cmd, int in_cmd_size, struct cmd_header *in_cmd, int in_cmd_size,
......
...@@ -109,7 +109,7 @@ static void if_usb_set_boot2_ver(struct lbs_private *priv) ...@@ -109,7 +109,7 @@ static void if_usb_set_boot2_ver(struct lbs_private *priv)
b2_cmd.action = 0; b2_cmd.action = 0;
b2_cmd.version = priv->boot2_version; b2_cmd.version = priv->boot2_version;
if (lbs_cmd(priv, CMD_SET_BOOT2_VER, b2_cmd, NULL, 0)) if (lbs_cmd(priv, CMD_SET_BOOT2_VER, &b2_cmd, NULL, 0))
lbs_deb_usb("Setting boot2 version failed\n"); lbs_deb_usb("Setting boot2 version failed\n");
} }
......
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