rt2800lib: fix wrong -128dBm when signal is stronger than -12dBm
commit7fc417556473f15efac269523c17eb92103c6484
authorLuigi Tarenga <luigi.tarenga@gmail.com>
Tue, 31 Jan 2012 17:51:23 +0000 (31 18:51 +0100)
committerJohn W. Linville <linville@tuxdriver.com>
Wed, 1 Feb 2012 20:25:59 +0000 (1 15:25 -0500)
tree89dab8636f96f2648e54fe69c1a17f29954e4bae
parentf9721ed2707661af75a414d09cdcd71f99a13f62
rt2800lib: fix wrong -128dBm when signal is stronger than -12dBm

This patch correct the type of variables containing the rssi
values read from the rxwi.

In function rt2800_agc_to_rssi() 3 variables (rssi0, rssi1, rss2)
defined as int was assigned a 16bit signed values as unsigned.
From a test with a hi-gain antenna I verified that the rxwi
contains signed rssi values in the  range -13/+81 (inclusive)
with 0 as an error condition. In case of negative values a
condition is triggered and the function return -128dBm while
the signal is at its maximum. This patch correct the cast so
negative values are not treated as very high positive values
(ex. -13 does not become 243).

Signed-off-by: Luigi Tarenga <luigi.tarenga@gmail.com>
Reviewed-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/rt2x00/rt2800lib.c