summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPriit Laes <plaes@plaes.org>2015-03-11 20:03:25 (GMT)
committerKalle Valo <kvalo@codeaurora.org>2015-03-16 15:54:11 (GMT)
commit54fb66d6fe98c75d5cb0b0487f0e2b00cb412be7 (patch)
treeff868b610d6e25bba5042cac9a73c395b2cddfb3
parent387f149a2ace2e2569fb8fde6011cce2a84e07b8 (diff)
downloadlinux-54fb66d6fe98c75d5cb0b0487f0e2b00cb412be7.tar.xz
rtlwifi: Clean rtl_evm_db_to_percentage a bit
Signed-off-by: Priit Laes <plaes@plaes.org> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
-rw-r--r--drivers/net/wireless/rtlwifi/stats.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/drivers/net/wireless/rtlwifi/stats.c b/drivers/net/wireless/rtlwifi/stats.c
index 2d0736a..4201d73 100644
--- a/drivers/net/wireless/rtlwifi/stats.c
+++ b/drivers/net/wireless/rtlwifi/stats.c
@@ -39,15 +39,8 @@ EXPORT_SYMBOL(rtl_query_rxpwrpercentage);
u8 rtl_evm_db_to_percentage(char value)
{
- char ret_val;
- ret_val = value;
-
- if (ret_val >= 0)
- ret_val = 0;
- if (ret_val <= -33)
- ret_val = -33;
- ret_val = 0 - ret_val;
- ret_val *= 3;
+ char ret_val = clamp(-value, 0, 33) * 3;
+
if (ret_val == 99)
ret_val = 100;