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>
This commit is contained in:
Mauro Dreissig 2020-07-05 11:35:49 -03:00 committed by Greg Kroah-Hartman
parent 4911537c6b
commit 4e4a6b7c18
3 changed files with 5 additions and 6 deletions

View File

@ -99,12 +99,12 @@ static void fill_fwpriv(struct _adapter *adapter, struct fw_priv *fwpriv)
default:
fwpriv->rf_config = RTL8712_RFC_1T2R;
}
fwpriv->mp_mode = (regpriv->mp_mode == 1) ? 1 : 0;
fwpriv->mp_mode = (regpriv->mp_mode == 1);
/* 0:off 1:on 2:auto */
fwpriv->vcs_type = regpriv->vrtl_carrier_sense;
fwpriv->vcs_mode = regpriv->vcs_type; /* 1:RTS/CTS 2:CTS to self */
/* default enable turbo_mode */
fwpriv->turbo_mode = ((regpriv->wifi_test == 1) ? 0 : 1);
fwpriv->turbo_mode = (regpriv->wifi_test != 1);
fwpriv->low_power_mode = regpriv->low_power;
}

View File

@ -17,7 +17,7 @@
#include "osdep_service.h"
#include "drv_types.h"
#define RND4(x) (((x >> 2) + (((x & 3) == 0) ? 0 : 1)) << 2)
#define RND4(x) (((x >> 2) + ((x & 3) != 0)) << 2)
struct intf_priv {
u8 *intf_dev;

View File

@ -143,9 +143,8 @@ static void update_recvframe_attrib_from_recvstat(struct rx_pkt_attrib *pattrib,
/*TODO:
* Offset 0
*/
pattrib->bdecrypted = ((le32_to_cpu(prxstat->rxdw0) & BIT(27)) >> 27)
? 0 : 1;
pattrib->crc_err = (le32_to_cpu(prxstat->rxdw0) & BIT(14)) >> 14;
pattrib->bdecrypted = (le32_to_cpu(prxstat->rxdw0) & BIT(27)) == 0;
pattrib->crc_err = (le32_to_cpu(prxstat->rxdw0) & BIT(14)) != 0;
/*Offset 4*/
/*Offset 8*/
/*Offset 12*/