Skip to content

Commit 3063da9

Browse files
mistraubegregkh
authored andcommitted
staging: rtl8712: simplify evm_db2percentage()
Use clamp() to simplify function evm_db2percentage() and reduce object file size. Signed-off-by: Michael Straube <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 38c0304 commit 3063da9

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

drivers/staging/rtl8712/rtl8712_recv.c

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -663,17 +663,11 @@ static u8 evm_db2percentage(s8 value)
663663
/*
664664
* -33dB~0dB to 0%~99%
665665
*/
666-
s8 ret_val;
666+
s8 ret_val = clamp(-value, 0, 33) * 3;
667667

668-
ret_val = value;
669-
if (ret_val >= 0)
670-
ret_val = 0;
671-
if (ret_val <= -33)
672-
ret_val = -33;
673-
ret_val = -ret_val;
674-
ret_val *= 3;
675668
if (ret_val == 99)
676669
ret_val = 100;
670+
677671
return ret_val;
678672
}
679673

0 commit comments

Comments
 (0)