Commit 4e4a6b7c authored by Mauro Dreissig's avatar Mauro Dreissig Committed by Greg Kroah-Hartman

staging: rtl8712: Simplify expressions with boolean logic

Simplify some expressions by using boolean operations.
Signed-off-by: default avatarMauro Dreissig <mukadr@gmail.com>
Link: https://lore.kernel.org/r/20200705143552.9368-3-mukadr@gmail.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 4911537c
...@@ -99,12 +99,12 @@ static void fill_fwpriv(struct _adapter *adapter, struct fw_priv *fwpriv) ...@@ -99,12 +99,12 @@ static void fill_fwpriv(struct _adapter *adapter, struct fw_priv *fwpriv)
default: default:
fwpriv->rf_config = RTL8712_RFC_1T2R; 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 */ /* 0:off 1:on 2:auto */
fwpriv->vcs_type = regpriv->vrtl_carrier_sense; fwpriv->vcs_type = regpriv->vrtl_carrier_sense;
fwpriv->vcs_mode = regpriv->vcs_type; /* 1:RTS/CTS 2:CTS to self */ fwpriv->vcs_mode = regpriv->vcs_type; /* 1:RTS/CTS 2:CTS to self */
/* default enable turbo_mode */ /* 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; fwpriv->low_power_mode = regpriv->low_power;
} }
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
#include "osdep_service.h" #include "osdep_service.h"
#include "drv_types.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 { struct intf_priv {
u8 *intf_dev; u8 *intf_dev;
......
...@@ -143,9 +143,8 @@ static void update_recvframe_attrib_from_recvstat(struct rx_pkt_attrib *pattrib, ...@@ -143,9 +143,8 @@ static void update_recvframe_attrib_from_recvstat(struct rx_pkt_attrib *pattrib,
/*TODO: /*TODO:
* Offset 0 * Offset 0
*/ */
pattrib->bdecrypted = ((le32_to_cpu(prxstat->rxdw0) & BIT(27)) >> 27) pattrib->bdecrypted = (le32_to_cpu(prxstat->rxdw0) & BIT(27)) == 0;
? 0 : 1; pattrib->crc_err = (le32_to_cpu(prxstat->rxdw0) & BIT(14)) != 0;
pattrib->crc_err = (le32_to_cpu(prxstat->rxdw0) & BIT(14)) >> 14;
/*Offset 4*/ /*Offset 4*/
/*Offset 8*/ /*Offset 8*/
/*Offset 12*/ /*Offset 12*/
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment