All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] staging: rtl8192e: simplify rtl92e_evm_db_to_percent()
@ 2020-01-18 19:53 ` Michael Straube
  0 siblings, 0 replies; 6+ messages in thread
From: Michael Straube @ 2020-01-18 19:53 UTC (permalink / raw)
  To: gregkh
  Cc: Larry.Finger, florian.c.schilhabel, devel, linux-kernel, Michael Straube

Use clamp() to simplify function rtl92e_evm_db_to_percent() and reduce
object file size.

Signed-off-by: Michael Straube <straube.linux@gmail.com>
---
 drivers/staging/rtl8192e/rtl8192e/rtl_core.c | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
index dace81a7d1ba..caf36b6bf0dc 100644
--- a/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
+++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c
@@ -1973,18 +1973,11 @@ u8 rtl92e_rx_db_to_percent(s8 antpower)
 
 u8 rtl92e_evm_db_to_percent(s8 value)
 {
-	s8 ret_val;
+	s8 ret_val = clamp(-value, 0, 33) * 3;
 
-	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;
 	if (ret_val == 99)
 		ret_val = 100;
+
 	return ret_val;
 }
 
-- 
2.24.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-01-18 19:55 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-18 19:53 [PATCH 1/3] staging: rtl8192e: simplify rtl92e_evm_db_to_percent() Michael Straube
2020-01-18 19:53 ` Michael Straube
2020-01-18 19:53 ` [PATCH 2/3] staging: rtl8192u: simplify rtl819x_evm_dbtopercentage() Michael Straube
2020-01-18 19:53   ` Michael Straube
2020-01-18 19:53 ` [PATCH 3/3] staging: rtl8712: simplify evm_db2percentage() Michael Straube
2020-01-18 19:53   ` Michael Straube

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.