aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/libertas/cmd.c
diff options
context:
space:
mode:
authorDavid Woodhouse <dwmw2@infradead.org>2007-12-17 22:43:48 -0500
committerDavid S. Miller <davem@davemloft.net>2008-01-28 18:07:47 -0500
commita7c458906542aacdda7289bb21f527a2dc4097ca (patch)
tree27b4e0b6e6be3647c95bd373d1217fd3dd2adb3a /drivers/net/wireless/libertas/cmd.c
parent354eca9820f1efbf11978585640f1b2e92d4c5b4 (diff)
libertas: convert RADIO_CONTROL 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/cmd.c')
-rw-r--r--drivers/net/wireless/libertas/cmd.c76
1 files changed, 27 insertions, 49 deletions
diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c
index 0ae98513ba88..3a7b82f99cb3 100644
--- a/drivers/net/wireless/libertas/cmd.c
+++ b/drivers/net/wireless/libertas/cmd.c
@@ -603,45 +603,6 @@ static int lbs_cmd_802_11_snmp_mib(struct lbs_private *priv,
603 return 0; 603 return 0;
604} 604}
605 605
606static int lbs_cmd_802_11_radio_control(struct lbs_private *priv,
607 struct cmd_ds_command *cmd,
608 int cmd_action)
609{
610 struct cmd_ds_802_11_radio_control *pradiocontrol = &cmd->params.radio;
611
612 lbs_deb_enter(LBS_DEB_CMD);
613
614 cmd->size =
615 cpu_to_le16((sizeof(struct cmd_ds_802_11_radio_control)) +
616 S_DS_GEN);
617 cmd->command = cpu_to_le16(CMD_802_11_RADIO_CONTROL);
618
619 pradiocontrol->action = cpu_to_le16(cmd_action);
620
621 switch (priv->preamble) {
622 case CMD_TYPE_SHORT_PREAMBLE:
623 pradiocontrol->control = cpu_to_le16(SET_SHORT_PREAMBLE);
624 break;
625
626 case CMD_TYPE_LONG_PREAMBLE:
627 pradiocontrol->control = cpu_to_le16(SET_LONG_PREAMBLE);
628 break;
629
630 case CMD_TYPE_AUTO_PREAMBLE:
631 default:
632 pradiocontrol->control = cpu_to_le16(SET_AUTO_PREAMBLE);
633 break;
634 }
635
636 if (priv->radioon)
637 pradiocontrol->control |= cpu_to_le16(TURN_ON_RF);
638 else
639 pradiocontrol->control &= cpu_to_le16(~TURN_ON_RF);
640
641 lbs_deb_leave(LBS_DEB_CMD);
642 return 0;
643}
644
645static int lbs_cmd_802_11_rf_tx_power(struct lbs_private *priv, 606static int lbs_cmd_802_11_rf_tx_power(struct lbs_private *priv,
646 struct cmd_ds_command *cmd, 607 struct cmd_ds_command *cmd,
647 u16 cmd_action, void *pdata_buf) 608 u16 cmd_action, void *pdata_buf)
@@ -1315,16 +1276,37 @@ void lbs_complete_command(struct lbs_private *priv, struct cmd_ctrl_node *cmd,
1315int lbs_set_radio_control(struct lbs_private *priv) 1276int lbs_set_radio_control(struct lbs_private *priv)
1316{ 1277{
1317 int ret = 0; 1278 int ret = 0;
1279 struct cmd_ds_802_11_radio_control cmd;
1318 1280
1319 lbs_deb_enter(LBS_DEB_CMD); 1281 lbs_deb_enter(LBS_DEB_CMD);
1320 1282
1321 ret = lbs_prepare_and_send_command(priv, 1283 cmd.hdr.size = cpu_to_le16(sizeof(cmd));
1322 CMD_802_11_RADIO_CONTROL, 1284 cmd.action = cpu_to_le16(CMD_ACT_SET);
1323 CMD_ACT_SET, 1285
1324 CMD_OPTION_WAITFORRSP, 0, NULL); 1286 switch (priv->preamble) {
1287 case CMD_TYPE_SHORT_PREAMBLE:
1288 cmd.control = cpu_to_le16(SET_SHORT_PREAMBLE);
1289 break;
1290
1291 case CMD_TYPE_LONG_PREAMBLE:
1292 cmd.control = cpu_to_le16(SET_LONG_PREAMBLE);
1293 break;
1294
1295 case CMD_TYPE_AUTO_PREAMBLE:
1296 default:
1297 cmd.control = cpu_to_le16(SET_AUTO_PREAMBLE);
1298 break;
1299 }
1325 1300
1326 lbs_deb_cmd("RADIO_SET: radio %d, preamble %d\n", 1301 if (priv->radioon)
1327 priv->radioon, priv->preamble); 1302 cmd.control |= cpu_to_le16(TURN_ON_RF);
1303 else
1304 cmd.control &= cpu_to_le16(~TURN_ON_RF);
1305
1306 lbs_deb_cmd("RADIO_SET: radio %d, preamble %d\n", priv->radioon,
1307 priv->preamble);
1308
1309 ret = lbs_cmd_with_response(priv, CMD_802_11_RADIO_CONTROL, &cmd);
1328 1310
1329 lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret); 1311 lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret);
1330 return ret; 1312 return ret;
@@ -1467,10 +1449,6 @@ int lbs_prepare_and_send_command(struct lbs_private *priv,
1467 cmd_action, pdata_buf); 1449 cmd_action, pdata_buf);
1468 break; 1450 break;
1469 1451
1470 case CMD_802_11_RADIO_CONTROL:
1471 ret = lbs_cmd_802_11_radio_control(priv, cmdptr, cmd_action);
1472 break;
1473
1474 case CMD_802_11_RATE_ADAPT_RATESET: 1452 case CMD_802_11_RATE_ADAPT_RATESET:
1475 ret = lbs_cmd_802_11_rate_adapt_rateset(priv, 1453 ret = lbs_cmd_802_11_rate_adapt_rateset(priv,
1476 cmdptr, cmd_action); 1454 cmdptr, cmd_action);