Skip to content

Commit 38c0304

Browse files
mistraubegregkh
authored andcommitted
staging: rtl8192u: simplify rtl819x_evm_dbtopercentage()
Use clamp() to simplify function rtl819x_evm_dbtopercentage() 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 05ecd10 commit 38c0304

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

drivers/staging/rtl8192u/r8192U_core.c

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3954,18 +3954,11 @@ static u8 rtl819x_query_rxpwrpercentage(s8 antpower)
39543954

39553955
static u8 rtl819x_evm_dbtopercentage(s8 value)
39563956
{
3957-
s8 ret_val;
3957+
s8 ret_val = clamp(-value, 0, 33) * 3;
39583958

3959-
ret_val = value;
3960-
3961-
if (ret_val >= 0)
3962-
ret_val = 0;
3963-
if (ret_val <= -33)
3964-
ret_val = -33;
3965-
ret_val = 0 - ret_val;
3966-
ret_val *= 3;
39673959
if (ret_val == 99)
39683960
ret_val = 100;
3961+
39693962
return ret_val;
39703963
}
39713964

0 commit comments

Comments
 (0)