Commit 345f2d84 authored by Oscar Carter's avatar Oscar Carter Committed by Greg Kroah-Hartman

staging: vt6656: Add formula to the vnt_rf_addpower function

Use a formula to calculate the return value of the vnt_rf_addpower
function instead of the "if" statement with literal values for every
case.
Signed-off-by: default avatarOscar Carter <oscar.carter@gmx.com>
Link: https://lore.kernel.org/r/20200425141514.5528-1-oscar.carter@gmx.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent f5e5e302
......@@ -538,26 +538,19 @@ int vnt_rf_write_embedded(struct vnt_private *priv, u32 data)
static u8 vnt_rf_addpower(struct vnt_private *priv)
{
int base;
s32 rssi = -priv->current_rssi;
if (!rssi)
return 7;
if (priv->rf_type == RF_VT3226D0) {
if (rssi < -70)
return 9;
else if (rssi < -65)
return 7;
else if (rssi < -60)
return 5;
} else {
if (rssi < -80)
return 9;
else if (rssi < -75)
return 7;
else if (rssi < -70)
return 5;
}
if (priv->rf_type == RF_VT3226D0)
base = -60;
else
base = -70;
if (rssi < base)
return ((rssi - base + 1) / -5) * 2 + 5;
return 0;
}
......
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