lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1426104209-6913-3-git-send-email-plaes@plaes.org>
Date:	Wed, 11 Mar 2015 22:03:25 +0200
From:	Priit Laes <plaes@...es.org>
To:	Kalle Valo <kvalo@...eaurora.org>
Cc:	Larry Finger <Larry.Finger@...inger.net>,
	linux-wireless@...r.kernel.org, netdev@...r.kernel.org,
	Chaoming Li <chaoming_li@...lsil.com.cn>,
	Priit Laes <plaes@...es.org>
Subject: [PATCH 2/6] rtlwifi: Clean rtl_evm_db_to_percentage a bit

Signed-off-by: Priit Laes <plaes@...es.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 netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ