broadband-modem: update signal quality normalization

This patch updates normalize_ciev_cind_signal_quality() in
MMBroadbandModem to remove an unnecessary check on 'quality >= 0' and
also makes sure the normalized signal quality is capped at 100 when no
maximum is specified.

This is revised from a patch originally authored by
Yunlian Jiang <yunlian@chromium.org>.

Bug reported on https://code.google.com/p/chromium/issues/detail?id=235989
This commit is contained in:
Ben Chan
2013-04-30 16:59:09 -05:00
committed by Dan Williams
parent 862eaf4d58
commit 32d6dda859
+2 -3
View File
@@ -1651,11 +1651,10 @@ normalize_ciev_cind_signal_quality (guint quality,
guint min,
guint max)
{
if (!max &&
quality >= 0) {
if (!max) {
/* If we didn't get a max, assume it was 5. Note that we do allow
* 0, meaning no signal at all. */
return (quality * 20);
return (quality <= 5) ? (quality * 20) : 100;
}
if (quality >= min &&