diff options
author | Dan Williams <dcbw@redhat.com> | 2007-12-11 16:54:15 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-01-28 18:06:50 -0500 |
commit | 2dd4b26264d48f10e802cc9f2d75542be5a3c7fa (patch) | |
tree | 2d79fa1cde5146df36c2add9c357e404512def94 /drivers/net/wireless/libertas/cmd.c | |
parent | 8e3c91bb70372da692a5fefae9f698c94bb1e641 (diff) |
libertas: convert RF_CHANNEL to a direct command
Signed-off-by: Dan Williams <dcbw@redhat.com>
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.c | 71 |
1 files changed, 53 insertions, 18 deletions
diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c index eff78792fc6f..32f9f880a15a 100644 --- a/drivers/net/wireless/libertas/cmd.c +++ b/drivers/net/wireless/libertas/cmd.c | |||
@@ -810,25 +810,65 @@ static int lbs_cmd_mac_multicast_adr(struct lbs_private *priv, | |||
810 | return 0; | 810 | return 0; |
811 | } | 811 | } |
812 | 812 | ||
813 | static int lbs_cmd_802_11_rf_channel(struct lbs_private *priv, | 813 | /** |
814 | struct cmd_ds_command *cmd, | 814 | * @brief Get the radio channel |
815 | int option, void *pdata_buf) | 815 | * |
816 | * @param priv A pointer to struct lbs_private structure | ||
817 | * | ||
818 | * @return The channel on success, error on failure | ||
819 | */ | ||
820 | int lbs_get_channel(struct lbs_private *priv) | ||
816 | { | 821 | { |
817 | struct cmd_ds_802_11_rf_channel *rfchan = &cmd->params.rfchannel; | 822 | struct cmd_ds_802_11_rf_channel cmd; |
823 | int ret = 0; | ||
818 | 824 | ||
819 | lbs_deb_enter(LBS_DEB_CMD); | 825 | lbs_deb_enter(LBS_DEB_CMD); |
820 | cmd->command = cpu_to_le16(CMD_802_11_RF_CHANNEL); | ||
821 | cmd->size = cpu_to_le16(sizeof(struct cmd_ds_802_11_rf_channel) + | ||
822 | S_DS_GEN); | ||
823 | 826 | ||
824 | if (option == CMD_OPT_802_11_RF_CHANNEL_SET) { | 827 | cmd.hdr.size = cpu_to_le16(sizeof(cmd)); |
825 | rfchan->currentchannel = cpu_to_le16(*((u16 *) pdata_buf)); | 828 | cmd.action = cpu_to_le16(CMD_OPT_802_11_RF_CHANNEL_GET); |
826 | } | ||
827 | 829 | ||
828 | rfchan->action = cpu_to_le16(option); | 830 | ret = lbs_cmd_with_response(priv, CMD_802_11_RF_CHANNEL, cmd); |
831 | if (ret) | ||
832 | goto out; | ||
829 | 833 | ||
830 | lbs_deb_leave(LBS_DEB_CMD); | 834 | lbs_deb_cmd("current radio channel is %d\n", cmd.channel); |
831 | return 0; | 835 | ret = (int) cmd.channel; |
836 | |||
837 | out: | ||
838 | lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret); | ||
839 | return ret; | ||
840 | } | ||
841 | |||
842 | /** | ||
843 | * @brief Set the radio channel | ||
844 | * | ||
845 | * @param priv A pointer to struct lbs_private structure | ||
846 | * @param channel The desired channel, or 0 to clear a locked channel | ||
847 | * | ||
848 | * @return 0 on success, error on failure | ||
849 | */ | ||
850 | int lbs_set_channel(struct lbs_private *priv, u8 channel) | ||
851 | { | ||
852 | struct cmd_ds_802_11_rf_channel cmd; | ||
853 | u8 old_channel = priv->curbssparams.channel; | ||
854 | int ret = 0; | ||
855 | |||
856 | lbs_deb_enter(LBS_DEB_CMD); | ||
857 | |||
858 | cmd.hdr.size = cpu_to_le16(sizeof(cmd)); | ||
859 | cmd.action = cpu_to_le16(CMD_OPT_802_11_RF_CHANNEL_SET); | ||
860 | cmd.channel = cpu_to_le16(channel); | ||
861 | |||
862 | ret = lbs_cmd_with_response(priv, CMD_802_11_RF_CHANNEL, cmd); | ||
863 | if (ret) | ||
864 | goto out; | ||
865 | |||
866 | priv->curbssparams.channel = cmd.channel; | ||
867 | lbs_deb_cmd("channel switch from %d to %d\n", old_channel, cmd.channel); | ||
868 | |||
869 | out: | ||
870 | lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret); | ||
871 | return ret; | ||
832 | } | 872 | } |
833 | 873 | ||
834 | static int lbs_cmd_802_11_rssi(struct lbs_private *priv, | 874 | static int lbs_cmd_802_11_rssi(struct lbs_private *priv, |
@@ -1390,11 +1430,6 @@ int lbs_prepare_and_send_command(struct lbs_private *priv, | |||
1390 | ret = lbs_cmd_reg_access(priv, cmdptr, cmd_action, pdata_buf); | 1430 | ret = lbs_cmd_reg_access(priv, cmdptr, cmd_action, pdata_buf); |
1391 | break; | 1431 | break; |
1392 | 1432 | ||
1393 | case CMD_802_11_RF_CHANNEL: | ||
1394 | ret = lbs_cmd_802_11_rf_channel(priv, cmdptr, | ||
1395 | cmd_action, pdata_buf); | ||
1396 | break; | ||
1397 | |||
1398 | case CMD_802_11_RF_TX_POWER: | 1433 | case CMD_802_11_RF_TX_POWER: |
1399 | ret = lbs_cmd_802_11_rf_tx_power(priv, cmdptr, | 1434 | ret = lbs_cmd_802_11_rf_tx_power(priv, cmdptr, |
1400 | cmd_action, pdata_buf); | 1435 | cmd_action, pdata_buf); |