staging: vt6656: mac80211 conversion: change vnt_rf_set_txpower
authorMalcolm Priestley <tvboxspy@gmail.com>
Wed, 25 Jun 2014 20:14:35 +0000 (21:14 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 27 Jun 2014 00:21:20 +0000 (20:21 -0400)
Remove old eScanState code and use.

priv->hw->conf.chandef.chan->hw_value to find current channel

Check hw_value for bounds of vt3226d0_lo_current_table

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/vt6656/rf.c

index 3f54ae3cfb4ef09284ad0a754ed5e6c3c3aa21e2..6bfd27234080878c2bc15c9ba56283c359b18232 100644 (file)
@@ -891,6 +891,8 @@ int vnt_rf_set_txpower(struct vnt_private *priv, u8 power, u32 rate)
                        return false;
 
                if (rate <= RATE_11M) {
+                       u16 hw_value = priv->hw->conf.chandef.chan->hw_value;
+
                        power_setting = ((0x3f-priv->byCurPwr) << 20) |
                                (0xe07 << 8) | (BY_VT3226_REG_LEN << 3) |
                                                IFREGCTL_REGW;
@@ -899,21 +901,14 @@ int vnt_rf_set_txpower(struct vnt_private *priv, u8 power, u32 rate)
                        ret &= vnt_rf_write_embedded(priv, 0x03c6a200 +
                                        (BY_VT3226_REG_LEN<<3)+IFREGCTL_REGW);
 
-                       if (priv->vnt_mgmt.eScanState != WMAC_NO_SCANNING) {
-                               dev_dbg(&priv->usb->dev,
-                               "vnt_rf_set_txpower> 11B mode uCurrChannel[%d]\n",
-                                               priv->vnt_mgmt.uScanChannel);
-                               ret &= vnt_rf_write_embedded(priv,
-                                       vt3226d0_lo_current_table[priv->
-                                               vnt_mgmt.uScanChannel - 1]);
-                       } else {
-                               dev_dbg(&priv->usb->dev,
-                               "vnt_rf_set_txpower> 11B mode uCurrChannel[%d]\n",
-                                               priv->vnt_mgmt.uCurrChannel);
+                       dev_dbg(&priv->usb->dev,
+                               "%s 11b channel [%d]\n", __func__, hw_value);
+
+                       hw_value--;
+
+                       if (hw_value < ARRAY_SIZE(vt3226d0_lo_current_table))
                                ret &= vnt_rf_write_embedded(priv,
-                                       vt3226d0_lo_current_table[priv->
-                                               vnt_mgmt.uCurrChannel - 1]);
-                       }
+                                       vt3226d0_lo_current_table[hw_value]);
 
                        ret &= vnt_rf_write_embedded(priv, 0x015C0800 +
                                (BY_VT3226_REG_LEN<<3)+IFREGCTL_REGW);