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) ...@@ -538,26 +538,19 @@ int vnt_rf_write_embedded(struct vnt_private *priv, u32 data)
static u8 vnt_rf_addpower(struct vnt_private *priv) static u8 vnt_rf_addpower(struct vnt_private *priv)
{ {
int base;
s32 rssi = -priv->current_rssi; s32 rssi = -priv->current_rssi;
if (!rssi) if (!rssi)
return 7; return 7;
if (priv->rf_type == RF_VT3226D0) { if (priv->rf_type == RF_VT3226D0)
if (rssi < -70) base = -60;
return 9; else
else if (rssi < -65) base = -70;
return 7;
else if (rssi < -60) if (rssi < base)
return 5; return ((rssi - base + 1) / -5) * 2 + 5;
} else {
if (rssi < -80)
return 9;
else if (rssi < -75)
return 7;
else if (rssi < -70)
return 5;
}
return 0; 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