rtlwifi: Clean rtl_evm_db_to_percentage a bit
authorPriit Laes <plaes@plaes.org>
Wed, 11 Mar 2015 20:03:25 +0000 (22:03 +0200)
committerKalle Valo <kvalo@codeaurora.org>
Mon, 16 Mar 2015 15:54:11 +0000 (17:54 +0200)
Signed-off-by: Priit Laes <plaes@plaes.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/rtlwifi/stats.c

index 2d0736a09fc0e0a590724ff4415134018b3f8293..4201d7340d4920bc1620e02fdeaf8423b1411d3c 100644 (file)
@@ -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;