nl80211: use floats for signal quality calculations

Since we're working with numbers less than one but greater than
zero, we need floats.  Otherwise stuff just gets clipped.
This commit is contained in:
Dan Williams 2011-10-06 09:34:10 -05:00
parent 3f39e6a95f
commit 8faa032a27

View file

@ -215,8 +215,8 @@ static guint32 nl80211_mbm_to_percent (gint32 mbm)
mbm = CLAMP(mbm, NOISE_FLOOR_MBM, SIGNAL_MAX_MBM);
return 100 - 70 * ((SIGNAL_MAX_MBM - mbm) /
(SIGNAL_MAX_MBM - NOISE_FLOOR_MBM));
return 100 - 70 * (((float) SIGNAL_MAX_MBM - (float) mbm) /
((float) SIGNAL_MAX_MBM - (float) NOISE_FLOOR_MBM));
}
struct nl80211_bss_info {