Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

staging: rtl8712: Simplify expressions with boolean logic

Simplify some expressions by using boolean operations.

Signed-off-by: Mauro Dreissig <mukadr@gmail.com>
Link: https://lore.kernel.org/r/20200705143552.9368-3-mukadr@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Mauro Dreissig and committed by
Greg Kroah-Hartman
4e4a6b7c 4911537c

+5 -6
+2 -2
drivers/staging/rtl8712/hal_init.c
··· 99 99 default: 100 100 fwpriv->rf_config = RTL8712_RFC_1T2R; 101 101 } 102 - fwpriv->mp_mode = (regpriv->mp_mode == 1) ? 1 : 0; 102 + fwpriv->mp_mode = (regpriv->mp_mode == 1); 103 103 /* 0:off 1:on 2:auto */ 104 104 fwpriv->vcs_type = regpriv->vrtl_carrier_sense; 105 105 fwpriv->vcs_mode = regpriv->vcs_type; /* 1:RTS/CTS 2:CTS to self */ 106 106 /* default enable turbo_mode */ 107 - fwpriv->turbo_mode = ((regpriv->wifi_test == 1) ? 0 : 1); 107 + fwpriv->turbo_mode = (regpriv->wifi_test != 1); 108 108 fwpriv->low_power_mode = regpriv->low_power; 109 109 } 110 110
+1 -1
drivers/staging/rtl8712/osdep_intf.h
··· 17 17 #include "osdep_service.h" 18 18 #include "drv_types.h" 19 19 20 - #define RND4(x) (((x >> 2) + (((x & 3) == 0) ? 0 : 1)) << 2) 20 + #define RND4(x) (((x >> 2) + ((x & 3) != 0)) << 2) 21 21 22 22 struct intf_priv { 23 23 u8 *intf_dev;
+2 -3
drivers/staging/rtl8712/rtl8712_recv.c
··· 143 143 /*TODO: 144 144 * Offset 0 145 145 */ 146 - pattrib->bdecrypted = ((le32_to_cpu(prxstat->rxdw0) & BIT(27)) >> 27) 147 - ? 0 : 1; 148 - pattrib->crc_err = (le32_to_cpu(prxstat->rxdw0) & BIT(14)) >> 14; 146 + pattrib->bdecrypted = (le32_to_cpu(prxstat->rxdw0) & BIT(27)) == 0; 147 + pattrib->crc_err = (le32_to_cpu(prxstat->rxdw0) & BIT(14)) != 0; 149 148 /*Offset 4*/ 150 149 /*Offset 8*/ 151 150 /*Offset 12*/