From 54fb66d6fe98c75d5cb0b0487f0e2b00cb412be7 Mon Sep 17 00:00:00 2001 From: Priit Laes Date: Wed, 11 Mar 2015 22:03:25 +0200 Subject: [PATCH] rtlwifi: Clean rtl_evm_db_to_percentage a bit Signed-off-by: Priit Laes Signed-off-by: Kalle Valo --- drivers/net/wireless/rtlwifi/stats.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/drivers/net/wireless/rtlwifi/stats.c b/drivers/net/wireless/rtlwifi/stats.c index 2d0736a09fc0..4201d7340d49 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; -- 2.39.5