diff options
author | Andrea Merello <andrea.merello@gmail.com> | 2014-05-31 18:29:46 +0200 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2014-06-19 21:49:12 +0200 |
commit | afbedbf7dfc0ebff0ea3280530fe0609fd307486 (patch) | |
tree | b9e8d346cff09f8fe7819653b62bb06a88f1b999 /drivers/net/wireless/rtl818x | |
parent | cw1200: Remove useless return variables (diff) | |
download | linux-afbedbf7dfc0ebff0ea3280530fe0609fd307486.tar.xz linux-afbedbf7dfc0ebff0ea3280530fe0609fd307486.zip |
rtl818x_pci: make RSSI code more readable
remove the if-else chains and use switch-case to make code more
readable and avoiding long lines that broke in several lines
Signed-off-by: Andrea Merello <andrea.merello@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/rtl818x')
-rw-r--r-- | drivers/net/wireless/rtl818x/rtl8180/dev.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/drivers/net/wireless/rtl818x/rtl8180/dev.c b/drivers/net/wireless/rtl818x/rtl8180/dev.c index 2c1c02bafa10..c2dd5e636d28 100644 --- a/drivers/net/wireless/rtl818x/rtl8180/dev.c +++ b/drivers/net/wireless/rtl818x/rtl8180/dev.c @@ -209,7 +209,7 @@ static void rtl8180_handle_rx(struct ieee80211_hw *dev) struct rtl8180_priv *priv = dev->priv; struct rtl818x_rx_cmd_desc *cmd_desc; unsigned int count = 32; - u8 signal, agc, sq; + u8 agc, sq, signal = 1; dma_addr_t mapping; while (count--) { @@ -266,18 +266,21 @@ static void rtl8180_handle_rx(struct ieee80211_hw *dev) rx_status.rate_idx = (flags >> 20) & 0xF; agc = (flags2 >> 17) & 0x7F; - if (priv->chip_family == RTL818X_CHIP_FAMILY_RTL8185) { + switch (priv->chip_family) { + case RTL818X_CHIP_FAMILY_RTL8185: if (rx_status.rate_idx > 3) signal = 90 - clamp_t(u8, agc, 25, 90); else signal = 95 - clamp_t(u8, agc, 30, 95); - } else if (priv->chip_family == - RTL818X_CHIP_FAMILY_RTL8180) { + break; + case RTL818X_CHIP_FAMILY_RTL8180: sq = flags2 & 0xff; signal = priv->rf->calc_rssi(agc, sq); - } else { + break; + case RTL818X_CHIP_FAMILY_RTL8187SE: /* TODO: rtl8187se rssi */ signal = 10; + break; } rx_status.signal = signal; rx_status.freq = dev->conf.chandef.chan->center_freq; |