Signed-off-by: Priit Laes <pl...@plaes.org>
---
 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 874e7d1..2021223 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.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to