aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/libertas/main.c
diff options
context:
space:
mode:
authorDavid Woodhouse <dwmw2@infradead.org>2007-12-11 15:23:59 -0500
committerDavid S. Miller <davem@davemloft.net>2008-01-28 18:06:46 -0500
commit301eacbf30e33f461701df91cb250d3fc24c5fe5 (patch)
tree287a89838a0e5a36f390fba615e60bdc75baa037 /drivers/net/wireless/libertas/main.c
parentad9d7a7f3cc73a6288920cc17c807f56bd8327fc (diff)
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/wireless/libertas/main.c')
-rw-r--r--drivers/net/wireless/libertas/main.c40
1 files changed, 20 insertions, 20 deletions
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)
217static ssize_t lbs_anycast_get(struct device *dev, 217static ssize_t lbs_anycast_get(struct device *dev,
218 struct device_attribute *attr, char * buf) 218 struct device_attribute *attr, char * buf)
219{ 219{
220 struct lbs_private *priv = to_net_dev(dev)->priv;
220 struct cmd_ds_mesh_access mesh_access; 221 struct cmd_ds_mesh_access mesh_access;
222 int ret;
221 223
222 memset(&mesh_access, 0, sizeof(mesh_access)); 224 memset(&mesh_access, 0, sizeof(mesh_access));
223 lbs_prepare_and_send_command(to_net_dev(dev)->priv, 225
224 CMD_MESH_ACCESS, 226 ret = lbs_mesh_access(priv, CMD_ACT_MESH_GET_ANYCAST, &mesh_access);
225 CMD_ACT_MESH_GET_ANYCAST, 227 if (ret)
226 CMD_OPTION_WAITFORRSP, 0, (void *)&mesh_access); 228 return ret;
227 229
228 return snprintf(buf, 12, "0x%X\n", le32_to_cpu(mesh_access.data[0])); 230 return snprintf(buf, 12, "0x%X\n", le32_to_cpu(mesh_access.data[0]));
229} 231}
@@ -234,17 +236,19 @@ static ssize_t lbs_anycast_get(struct device *dev,
234static ssize_t lbs_anycast_set(struct device *dev, 236static ssize_t lbs_anycast_set(struct device *dev,
235 struct device_attribute *attr, const char * buf, size_t count) 237 struct device_attribute *attr, const char * buf, size_t count)
236{ 238{
239 struct lbs_private *priv = to_net_dev(dev)->priv;
237 struct cmd_ds_mesh_access mesh_access; 240 struct cmd_ds_mesh_access mesh_access;
238 uint32_t datum; 241 uint32_t datum;
242 int ret;
239 243
240 memset(&mesh_access, 0, sizeof(mesh_access)); 244 memset(&mesh_access, 0, sizeof(mesh_access));
241 sscanf(buf, "%x", &datum); 245 sscanf(buf, "%x", &datum);
242 mesh_access.data[0] = cpu_to_le32(datum); 246 mesh_access.data[0] = cpu_to_le32(datum);
243 247
244 lbs_prepare_and_send_command((to_net_dev(dev))->priv, 248 ret = lbs_mesh_access(priv, CMD_ACT_MESH_SET_ANYCAST, &mesh_access);
245 CMD_MESH_ACCESS, 249 if (ret)
246 CMD_ACT_MESH_SET_ANYCAST, 250 return ret;
247 CMD_OPTION_WAITFORRSP, 0, (void *)&mesh_access); 251
248 return strlen(buf); 252 return strlen(buf);
249} 253}
250 254
@@ -323,14 +327,15 @@ static DEVICE_ATTR(anycast_mask, 0644, lbs_anycast_get, lbs_anycast_set);
323static ssize_t lbs_autostart_enabled_get(struct device *dev, 327static ssize_t lbs_autostart_enabled_get(struct device *dev,
324 struct device_attribute *attr, char * buf) 328 struct device_attribute *attr, char * buf)
325{ 329{
330 struct lbs_private *priv = to_net_dev(dev)->priv;
326 struct cmd_ds_mesh_access mesh_access; 331 struct cmd_ds_mesh_access mesh_access;
332 int ret;
327 333
328 memset(&mesh_access, 0, sizeof(mesh_access)); 334 memset(&mesh_access, 0, sizeof(mesh_access));
329 lbs_prepare_and_send_command(to_net_dev(dev)->priv,
330 CMD_MESH_ACCESS,
331 CMD_ACT_MESH_GET_AUTOSTART_ENABLED,
332 CMD_OPTION_WAITFORRSP, 0, (void *)&mesh_access);
333 335
336 ret = lbs_mesh_access(priv, CMD_ACT_MESH_GET_AUTOSTART_ENABLED, &mesh_access);
337 if (ret)
338 return ret;
334 return sprintf(buf, "%d\n", le32_to_cpu(mesh_access.data[0])); 339 return sprintf(buf, "%d\n", le32_to_cpu(mesh_access.data[0]));
335} 340}
336 341
@@ -346,10 +351,7 @@ static ssize_t lbs_autostart_enabled_set(struct device *dev,
346 sscanf(buf, "%d", &datum); 351 sscanf(buf, "%d", &datum);
347 mesh_access.data[0] = cpu_to_le32(datum); 352 mesh_access.data[0] = cpu_to_le32(datum);
348 353
349 ret = lbs_prepare_and_send_command(priv, 354 ret = lbs_mesh_access(priv, CMD_ACT_MESH_SET_AUTOSTART_ENABLED, &mesh_access);
350 CMD_MESH_ACCESS,
351 CMD_ACT_MESH_SET_AUTOSTART_ENABLED,
352 CMD_OPTION_WAITFORRSP, 0, (void *)&mesh_access);
353 if (ret == 0) 355 if (ret == 0)
354 priv->mesh_autostart_enabled = datum ? 1 : 0; 356 priv->mesh_autostart_enabled = datum ? 1 : 0;
355 357
@@ -866,10 +868,8 @@ static int lbs_setup_firmware(struct lbs_private *priv)
866 if (priv->mesh_dev) { 868 if (priv->mesh_dev) {
867 memset(&mesh_access, 0, sizeof(mesh_access)); 869 memset(&mesh_access, 0, sizeof(mesh_access));
868 mesh_access.data[0] = cpu_to_le32(0); 870 mesh_access.data[0] = cpu_to_le32(0);
869 ret = lbs_prepare_and_send_command(priv, 871 ret = lbs_mesh_access(priv, CMD_ACT_MESH_SET_AUTOSTART_ENABLED,
870 CMD_MESH_ACCESS, 872 &mesh_access);
871 CMD_ACT_MESH_SET_AUTOSTART_ENABLED,
872 CMD_OPTION_WAITFORRSP, 0, (void *)&mesh_access);
873 if (ret) { 873 if (ret) {
874 ret = -1; 874 ret = -1;
875 goto done; 875 goto done;