Commit 72183c6b authored by Malcolm Priestley's avatar Malcolm Priestley Committed by Greg Kroah-Hartman

staging: vt6656: vnt_rf_set_txpower use power for priv->byCurPwr

The byCurPwr value can change state while in another thread,.

Change to local variable power which is the last set value.
Signed-off-by: default avatarMalcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent ba911c9b
...@@ -821,11 +821,10 @@ int vnt_rf_set_txpower(struct vnt_private *priv, u8 power, u32 rate) ...@@ -821,11 +821,10 @@ int vnt_rf_set_txpower(struct vnt_private *priv, u8 power, u32 rate)
switch (priv->byRFType) { switch (priv->byRFType) {
case RF_AL2230: case RF_AL2230:
if (priv->byCurPwr >= AL2230_PWR_IDX_LEN) if (power >= AL2230_PWR_IDX_LEN)
return false; return false;
ret &= vnt_rf_write_embedded(priv, ret &= vnt_rf_write_embedded(priv, al2230_power_table[power]);
al2230_power_table[priv->byCurPwr]);
if (rate <= RATE_11M) if (rate <= RATE_11M)
ret &= vnt_rf_write_embedded(priv, 0x0001b400 + ret &= vnt_rf_write_embedded(priv, 0x0001b400 +
...@@ -835,11 +834,10 @@ int vnt_rf_set_txpower(struct vnt_private *priv, u8 power, u32 rate) ...@@ -835,11 +834,10 @@ int vnt_rf_set_txpower(struct vnt_private *priv, u8 power, u32 rate)
(BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW); (BY_AL2230_REG_LEN << 3) + IFREGCTL_REGW);
break; break;
case RF_AL2230S: case RF_AL2230S:
if (priv->byCurPwr >= AL2230_PWR_IDX_LEN) if (power >= AL2230_PWR_IDX_LEN)
return false; return false;
ret &= vnt_rf_write_embedded(priv, ret &= vnt_rf_write_embedded(priv, al2230_power_table[power]);
al2230_power_table[priv->byCurPwr]);
if (rate <= RATE_11M) { if (rate <= RATE_11M) {
ret &= vnt_rf_write_embedded(priv, 0x040c1400 + ret &= vnt_rf_write_embedded(priv, 0x040c1400 +
...@@ -862,14 +860,14 @@ int vnt_rf_set_txpower(struct vnt_private *priv, u8 power, u32 rate) ...@@ -862,14 +860,14 @@ int vnt_rf_set_txpower(struct vnt_private *priv, u8 power, u32 rate)
ret &= vnt_rf_write_embedded(priv, 0x221bb900 + ret &= vnt_rf_write_embedded(priv, 0x221bb900 +
(BY_AL7230_REG_LEN << 3)+IFREGCTL_REGW); (BY_AL7230_REG_LEN << 3)+IFREGCTL_REGW);
if (priv->byCurPwr > AL7230_PWR_IDX_LEN) if (power >= AL7230_PWR_IDX_LEN)
return false; return false;
/* /*
* 0x080F1B00 for 3 wire control TxGain(D10) * 0x080F1B00 for 3 wire control TxGain(D10)
* and 0x31 as TX Gain value * and 0x31 as TX Gain value
*/ */
power_setting = 0x080c0b00 | ((priv->byCurPwr) << 12) | power_setting = 0x080c0b00 | (power << 12) |
(BY_AL7230_REG_LEN << 3) | IFREGCTL_REGW; (BY_AL7230_REG_LEN << 3) | IFREGCTL_REGW;
ret &= vnt_rf_write_embedded(priv, power_setting); ret &= vnt_rf_write_embedded(priv, power_setting);
...@@ -877,22 +875,22 @@ int vnt_rf_set_txpower(struct vnt_private *priv, u8 power, u32 rate) ...@@ -877,22 +875,22 @@ int vnt_rf_set_txpower(struct vnt_private *priv, u8 power, u32 rate)
break; break;
case RF_VT3226: case RF_VT3226:
if (priv->byCurPwr >= VT3226_PWR_IDX_LEN) if (power >= VT3226_PWR_IDX_LEN)
return false; return false;
power_setting = ((0x3f - priv->byCurPwr) << 20) | (0x17 << 8) | power_setting = ((0x3f - power) << 20) | (0x17 << 8) |
(BY_VT3226_REG_LEN << 3) | IFREGCTL_REGW; (BY_VT3226_REG_LEN << 3) | IFREGCTL_REGW;
ret &= vnt_rf_write_embedded(priv, power_setting); ret &= vnt_rf_write_embedded(priv, power_setting);
break; break;
case RF_VT3226D0: case RF_VT3226D0:
if (priv->byCurPwr >= VT3226_PWR_IDX_LEN) if (power >= VT3226_PWR_IDX_LEN)
return false; return false;
if (rate <= RATE_11M) { if (rate <= RATE_11M) {
u16 hw_value = priv->hw->conf.chandef.chan->hw_value; u16 hw_value = priv->hw->conf.chandef.chan->hw_value;
power_setting = ((0x3f-priv->byCurPwr) << 20) | power_setting = ((0x3f - power) << 20) |
(0xe07 << 8) | (BY_VT3226_REG_LEN << 3) | (0xe07 << 8) | (BY_VT3226_REG_LEN << 3) |
IFREGCTL_REGW; IFREGCTL_REGW;
...@@ -915,7 +913,7 @@ int vnt_rf_set_txpower(struct vnt_private *priv, u8 power, u32 rate) ...@@ -915,7 +913,7 @@ int vnt_rf_set_txpower(struct vnt_private *priv, u8 power, u32 rate)
dev_dbg(&priv->usb->dev, dev_dbg(&priv->usb->dev,
"@@@@ vnt_rf_set_txpower> 11G mode\n"); "@@@@ vnt_rf_set_txpower> 11G mode\n");
power_setting = ((0x3f-priv->byCurPwr) << 20) | power_setting = ((0x3f - power) << 20) |
(0x7 << 8) | (BY_VT3226_REG_LEN << 3) | (0x7 << 8) | (BY_VT3226_REG_LEN << 3) |
IFREGCTL_REGW; IFREGCTL_REGW;
...@@ -930,10 +928,10 @@ int vnt_rf_set_txpower(struct vnt_private *priv, u8 power, u32 rate) ...@@ -930,10 +928,10 @@ int vnt_rf_set_txpower(struct vnt_private *priv, u8 power, u32 rate)
break; break;
case RF_VT3342A0: case RF_VT3342A0:
if (priv->byCurPwr >= VT3342_PWR_IDX_LEN) if (power >= VT3342_PWR_IDX_LEN)
return false; return false;
power_setting = ((0x3F-priv->byCurPwr) << 20) | power_setting = ((0x3f - power) << 20) |
(0x27 << 8) | (BY_VT3342_REG_LEN << 3) | (0x27 << 8) | (BY_VT3342_REG_LEN << 3) |
IFREGCTL_REGW; IFREGCTL_REGW;
......
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