Avoid potential precedences issues by wrapping macro parameters in parentheses. Signed-off-by: Sebastian Haas <sehaas@xxxxxxxxxx> --- drivers/staging/rtl8188eu/include/Hal8188EPhyReg.h | 2 +- drivers/staging/rtl8188eu/include/Hal8188ERateAdaptive.h | 16 ++++++++-------- drivers/staging/rtl8188eu/include/odm.h | 2 +- drivers/staging/rtl8188eu/include/odm_debug.h | 2 +- drivers/staging/rtl8188eu/include/odm_types.h | 6 +++--- drivers/staging/rtl8188eu/include/rtl8188e_hal.h | 4 ++-- drivers/staging/rtl8188eu/include/rtl8188e_xmit.h | 6 +++--- drivers/staging/rtl8188eu/include/rtw_debug.h | 6 +++--- drivers/staging/rtl8188eu/include/rtw_efuse.h | 6 +++--- drivers/staging/rtl8188eu/include/rtw_ioctl.h | 2 +- drivers/staging/rtl8188eu/include/rtw_mlme_ext.h | 4 ++-- drivers/staging/rtl8188eu/include/rtw_mp_phy_regdef.h | 3 ++- drivers/staging/rtl8188eu/include/rtw_pwrctrl.h | 6 +++--- drivers/staging/rtl8188eu/include/rtw_recv.h | 4 ++-- drivers/staging/rtl8188eu/include/rtw_security.h | 4 ++-- drivers/staging/rtl8188eu/include/rtw_xmit.h | 2 +- drivers/staging/rtl8188eu/include/sta_info.h | 2 +- drivers/staging/rtl8188eu/include/wifi.h | 8 ++++---- 18 files changed, 43 insertions(+), 42 deletions(-) diff --git a/drivers/staging/rtl8188eu/include/Hal8188EPhyReg.h b/drivers/staging/rtl8188eu/include/Hal8188EPhyReg.h index 344c73d..15fccf4 100644 --- a/drivers/staging/rtl8188eu/include/Hal8188EPhyReg.h +++ b/drivers/staging/rtl8188eu/include/Hal8188EPhyReg.h @@ -495,7 +495,7 @@ #define bOFDMTxStatus 0x2 #define IS_BB_REG_OFFSET_92S(_Offset) \ - ((_Offset >= 0x800) && (_Offset <= 0xfff)) + (((_Offset) >= 0x800) && ((_Offset) <= 0xfff)) /* 2. Page8(0x800) */ #define bRFMOD 0x1 /* Reg 0x800 rFPGA0_RFMOD */ diff --git a/drivers/staging/rtl8188eu/include/Hal8188ERateAdaptive.h b/drivers/staging/rtl8188eu/include/Hal8188ERateAdaptive.h index 21996a1..e81d571 100644 --- a/drivers/staging/rtl8188eu/include/Hal8188ERateAdaptive.h +++ b/drivers/staging/rtl8188eu/include/Hal8188ERateAdaptive.h @@ -27,24 +27,24 @@ Major Change History: #define GET_TX_RPT2_DESC_PKT_LEN_88E(__pRxStatusDesc) \ LE_BITS_TO_4BYTE(__pRxStatusDesc, 0, 9) #define GET_TX_RPT2_DESC_MACID_VALID_1_88E(__pRxStatusDesc) \ - LE_BITS_TO_4BYTE(__pRxStatusDesc+16, 0, 32) + LE_BITS_TO_4BYTE((__pRxStatusDesc) + 16, 0, 32) #define GET_TX_RPT2_DESC_MACID_VALID_2_88E(__pRxStatusDesc) \ - LE_BITS_TO_4BYTE(__pRxStatusDesc+20, 0, 32) + LE_BITS_TO_4BYTE((__pRxStatusDesc) + 20, 0, 32) #define GET_TX_REPORT_TYPE1_RERTY_0(__pAddr) \ LE_BITS_TO_4BYTE(__pAddr, 0, 16) #define GET_TX_REPORT_TYPE1_RERTY_1(__pAddr) \ - LE_BITS_TO_1BYTE(__pAddr+2, 0, 8) + LE_BITS_TO_1BYTE((__pAddr) + 2, 0, 8) #define GET_TX_REPORT_TYPE1_RERTY_2(__pAddr) \ - LE_BITS_TO_1BYTE(__pAddr+3, 0, 8) + LE_BITS_TO_1BYTE((__pAddr) + 3, 0, 8) #define GET_TX_REPORT_TYPE1_RERTY_3(__pAddr) \ - LE_BITS_TO_1BYTE(__pAddr+4, 0, 8) + LE_BITS_TO_1BYTE((__pAddr) + 4, 0, 8) #define GET_TX_REPORT_TYPE1_RERTY_4(__pAddr) \ - LE_BITS_TO_1BYTE(__pAddr+4+1, 0, 8) + LE_BITS_TO_1BYTE((__pAddr) + 4 + 1, 0, 8) #define GET_TX_REPORT_TYPE1_DROP_0(__pAddr) \ - LE_BITS_TO_1BYTE(__pAddr+4+2, 0, 8) + LE_BITS_TO_1BYTE((__pAddr) + 4 + 2, 0, 8) #define GET_TX_REPORT_TYPE1_DROP_1(__pAddr) \ - LE_BITS_TO_1BYTE(__pAddr+4+3, 0, 8) + LE_BITS_TO_1BYTE((__pAddr) + 4 + 3, 0, 8) /* End rate adaptive define */ diff --git a/drivers/staging/rtl8188eu/include/odm.h b/drivers/staging/rtl8188eu/include/odm.h index 4fb3bb0..f5d7ed8 100644 --- a/drivers/staging/rtl8188eu/include/odm.h +++ b/drivers/staging/rtl8188eu/include/odm.h @@ -250,7 +250,7 @@ struct odm_rate_adapt { #define AVG_THERMAL_NUM 8 #define IQK_Matrix_REG_NUM 8 -#define IQK_Matrix_Settings_NUM 1+24+21 +#define IQK_Matrix_Settings_NUM (1 + 24 + 21) #define DM_Type_ByFWi 0 #define DM_Type_ByDriver 1 diff --git a/drivers/staging/rtl8188eu/include/odm_debug.h b/drivers/staging/rtl8188eu/include/odm_debug.h index 52e51f19..515d19d 100644 --- a/drivers/staging/rtl8188eu/include/odm_debug.h +++ b/drivers/staging/rtl8188eu/include/odm_debug.h @@ -87,7 +87,7 @@ #define ODM_RT_TRACE(pDM_Odm, comp, level, fmt) \ if (((comp) & pDM_Odm->DebugComponents) && \ - (level <= pDM_Odm->DebugLevel)) { \ + ((level) <= pDM_Odm->DebugLevel)) { \ pr_info("[ODM-8188E] "); \ RT_PRINTK fmt; \ } diff --git a/drivers/staging/rtl8188eu/include/odm_types.h b/drivers/staging/rtl8188eu/include/odm_types.h index 3474a9c..935012d 100644 --- a/drivers/staging/rtl8188eu/include/odm_types.h +++ b/drivers/staging/rtl8188eu/include/odm_types.h @@ -23,10 +23,10 @@ enum HAL_STATUS { }; #define SET_TX_DESC_ANTSEL_A_88E(__pTxDesc, __Value) \ - SET_BITS_TO_LE_4BYTE(__pTxDesc+8, 24, 1, __Value) + SET_BITS_TO_LE_4BYTE((__pTxDesc) + 8, 24, 1, __Value) #define SET_TX_DESC_ANTSEL_B_88E(__pTxDesc, __Value) \ - SET_BITS_TO_LE_4BYTE(__pTxDesc+8, 25, 1, __Value) + SET_BITS_TO_LE_4BYTE((__pTxDesc) + 8, 25, 1, __Value) #define SET_TX_DESC_ANTSEL_C_88E(__pTxDesc, __Value) \ - SET_BITS_TO_LE_4BYTE(__pTxDesc+28, 29, 1, __Value) + SET_BITS_TO_LE_4BYTE((__pTxDesc) + 28, 29, 1, __Value) #endif /* __ODM_TYPES_H__ */ diff --git a/drivers/staging/rtl8188eu/include/rtl8188e_hal.h b/drivers/staging/rtl8188eu/include/rtl8188e_hal.h index 9330361..ca9db14 100644 --- a/drivers/staging/rtl8188eu/include/rtl8188e_hal.h +++ b/drivers/staging/rtl8188eu/include/rtl8188e_hal.h @@ -146,7 +146,7 @@ struct txpowerinfo24g { #define EFUSE_REAL_CONTENT_LEN 512 #define EFUSE_MAX_SECTION 16 #define EFUSE_IC_ID_OFFSET 506 /* For some inferior IC purpose*/ -#define AVAILABLE_EFUSE_ADDR(addr) (addr < EFUSE_REAL_CONTENT_LEN) +#define AVAILABLE_EFUSE_ADDR(addr) ((addr) < EFUSE_REAL_CONTENT_LEN) /* To prevent out of boundary programming case, */ /* leave 1byte and program full section */ /* 9bytes + 1byt + 5bytes and pre 1byte. */ @@ -166,7 +166,7 @@ struct txpowerinfo24g { #define EFUSE_MAX_WORD_UNIT_88E 4 #define EFUSE_IC_ID_OFFSET_88E 506 #define AVAILABLE_EFUSE_ADDR_88E(addr) \ - (addr < EFUSE_REAL_CONTENT_LEN_88E) + ((addr) < EFUSE_REAL_CONTENT_LEN_88E) /* To prevent out of boundary programming case, leave 1byte and program * full section */ /* 9bytes + 1byt + 5bytes and pre 1byte. */ diff --git a/drivers/staging/rtl8188eu/include/rtl8188e_xmit.h b/drivers/staging/rtl8188eu/include/rtl8188e_xmit.h index 66205b7..fbc312c 100644 --- a/drivers/staging/rtl8188eu/include/rtl8188e_xmit.h +++ b/drivers/staging/rtl8188eu/include/rtl8188e_xmit.h @@ -38,11 +38,11 @@ #define SET_EARLYMODE_LEN2_1(__pAddr, __Value) \ SET_BITS_TO_LE_4BYTE(__pAddr, 28, 4, __Value) #define SET_EARLYMODE_LEN2_2(__pAddr, __Value) \ - SET_BITS_TO_LE_4BYTE(__pAddr+4, 0, 8, __Value) + SET_BITS_TO_LE_4BYTE((__pAddr) + 4, 0, 8, __Value) #define SET_EARLYMODE_LEN3(__pAddr, __Value) \ - SET_BITS_TO_LE_4BYTE(__pAddr+4, 8, 12, __Value) + SET_BITS_TO_LE_4BYTE((__pAddr) + 4, 8, 12, __Value) #define SET_EARLYMODE_LEN4(__pAddr, __Value) \ - SET_BITS_TO_LE_4BYTE(__pAddr+4, 20, 12, __Value) + SET_BITS_TO_LE_4BYTE((__pAddr) + 4, 20, 12, __Value) /* */ /* defined for TX DESC Operation */ diff --git a/drivers/staging/rtl8188eu/include/rtw_debug.h b/drivers/staging/rtl8188eu/include/rtw_debug.h index 9cc4b8c..86dc6ea 100644 --- a/drivers/staging/rtl8188eu/include/rtw_debug.h +++ b/drivers/staging/rtl8188eu/include/rtw_debug.h @@ -69,7 +69,7 @@ extern u32 GlobalDebugLevel; #define DBG_88E_LEVEL(_level, fmt, arg...) \ do { \ - if (_level <= GlobalDebugLevel) \ + if ((_level) <= GlobalDebugLevel) \ pr_info(DRIVER_PREFIX fmt, ##arg); \ } while (0) @@ -87,7 +87,7 @@ extern u32 GlobalDebugLevel; #define RT_TRACE(_comp, _level, fmt) \ do { \ - if (_level <= GlobalDebugLevel) { \ + if ((_level) <= GlobalDebugLevel) { \ pr_info("%s [0x%08x,%d]", DRIVER_PREFIX, \ (unsigned int)_comp, _level); \ pr_info fmt; \ @@ -96,7 +96,7 @@ extern u32 GlobalDebugLevel; #define RT_PRINT_DATA(_comp, _level, _titlestring, _hexdata, _hexdatalen)\ do { \ - if (_level <= GlobalDebugLevel) { \ + if ((_level) <= GlobalDebugLevel) { \ int __i; \ u8 *ptr = (u8 *)_hexdata; \ pr_info("%s", DRIVER_PREFIX); \ diff --git a/drivers/staging/rtl8188eu/include/rtw_efuse.h b/drivers/staging/rtl8188eu/include/rtw_efuse.h index 168c12d..2a64645 100644 --- a/drivers/staging/rtl8188eu/include/rtw_efuse.h +++ b/drivers/staging/rtl8188eu/include/rtw_efuse.h @@ -43,9 +43,9 @@ #define EFUSE_MAX_HW_SIZE 512 #define EFUSE_MAX_SECTION_BASE 16 -#define EXT_HEADER(header) ((header & 0x1F) == 0x0F) -#define ALL_WORDS_DISABLED(wde) ((wde & 0x0F) == 0x0F) -#define GET_HDR_OFFSET_2_0(header) ((header & 0xE0) >> 5) +#define EXT_HEADER(header) (((header) & 0x1F) == 0x0F) +#define ALL_WORDS_DISABLED(wde) (((wde) & 0x0F) == 0x0F) +#define GET_HDR_OFFSET_2_0(header) (((header) & 0xE0) >> 5) #define EFUSE_REPEAT_THRESHOLD_ 3 diff --git a/drivers/staging/rtl8188eu/include/rtw_ioctl.h b/drivers/staging/rtl8188eu/include/rtw_ioctl.h index a6b1c85..5ebad2b 100644 --- a/drivers/staging/rtl8188eu/include/rtw_ioctl.h +++ b/drivers/staging/rtl8188eu/include/rtw_ioctl.h @@ -59,7 +59,7 @@ #define OID_MP_SEG4 0xFF011100 #define DEBUG_OID(dbg, str) \ - if ((!dbg)) { \ + if ((!(dbg))) { \ RT_TRACE(_module_rtl871x_ioctl_c_, _drv_info_, \ ("%s(%d): %s", __func__, __line__, str)); \ } diff --git a/drivers/staging/rtl8188eu/include/rtw_mlme_ext.h b/drivers/staging/rtl8188eu/include/rtw_mlme_ext.h index 1b1caaf..2d31375 100644 --- a/drivers/staging/rtl8188eu/include/rtw_mlme_ext.h +++ b/drivers/staging/rtl8188eu/include/rtw_mlme_ext.h @@ -169,8 +169,8 @@ enum RT_CHANNEL_DOMAIN_2G { }; #define rtw_is_channel_plan_valid(chplan) \ - (chplan < RT_CHANNEL_DOMAIN_MAX || \ - chplan == RT_CHANNEL_DOMAIN_REALTEK_DEFINE) + ((chplan) < RT_CHANNEL_DOMAIN_MAX || \ + (chplan) == RT_CHANNEL_DOMAIN_REALTEK_DEFINE) struct rt_channel_plan { unsigned char Channel[MAX_CHANNEL_NUM]; diff --git a/drivers/staging/rtl8188eu/include/rtw_mp_phy_regdef.h b/drivers/staging/rtl8188eu/include/rtw_mp_phy_regdef.h index 02b3002..00588f8 100644 --- a/drivers/staging/rtl8188eu/include/rtw_mp_phy_regdef.h +++ b/drivers/staging/rtl8188eu/include/rtw_mp_phy_regdef.h @@ -439,7 +439,8 @@ #define bCCKTxStatus 0x1 #define bOFDMTxStatus 0x2 -#define IS_BB_REG_OFFSET_92S(_Offset) ((_Offset >= 0x800) && (_Offset <= 0xfff)) +#define IS_BB_REG_OFFSET_92S(_Offset) \ + (((_Offset) >= 0x800) && ((_Offset) <= 0xfff)) /* 2. Page8(0x800) */ #define bRFMOD 0x1 /* Reg 0x800 rFPGA0_RFMOD */ diff --git a/drivers/staging/rtl8188eu/include/rtw_pwrctrl.h b/drivers/staging/rtl8188eu/include/rtw_pwrctrl.h index 18a9e74..f0c8cc0 100644 --- a/drivers/staging/rtl8188eu/include/rtw_pwrctrl.h +++ b/drivers/staging/rtl8188eu/include/rtw_pwrctrl.h @@ -92,7 +92,7 @@ struct reportpwrstate_parm { unsigned short rsvd; }; -#define LPS_DELAY_TIME 1*HZ /* 1 sec */ +#define LPS_DELAY_TIME (1 * HZ) /* 1 sec */ #define EXE_PWR_NONE 0x01 #define EXE_PWR_IPS 0x02 @@ -121,7 +121,7 @@ enum rt_rf_power_state { #define RT_RF_LPS_LEVEL_ASPM BIT(31) /* LPS with ASPM */ #define RT_IN_PS_LEVEL(ppsc, _PS_FLAG) \ - ((ppsc->cur_ps_level & _PS_FLAG) ? true : false) + ((ppsc->cur_ps_level & (_PS_FLAG)) ? true : false) #define RT_CLEAR_PS_LEVEL(ppsc, _PS_FLAG) \ (ppsc->cur_ps_level &= (~(_PS_FLAG))) #define RT_SET_PS_LEVEL(ppsc, _PS_FLAG) \ @@ -205,7 +205,7 @@ struct pwrctrl_priv { }; #define rtw_get_ips_mode_req(pwrctrlpriv) \ - (pwrctrlpriv)->ips_mode_req + ((pwrctrlpriv)->ips_mode_req) #define rtw_ips_mode_req(pwrctrlpriv, ips_mode) \ ((pwrctrlpriv)->ips_mode_req = (ips_mode)) diff --git a/drivers/staging/rtl8188eu/include/rtw_recv.h b/drivers/staging/rtl8188eu/include/rtw_recv.h index b369f08..c505dca 100644 --- a/drivers/staging/rtl8188eu/include/rtw_recv.h +++ b/drivers/staging/rtl8188eu/include/rtw_recv.h @@ -135,8 +135,8 @@ struct rx_pkt_attrib { /* These definition is used for Rx packet reordering. */ -#define SN_LESS(a, b) (((a - b) & 0x800) != 0) -#define SN_EQUAL(a, b) (a == b) +#define SN_LESS(a, b) ((((a) - (b)) & 0x800) != 0) +#define SN_EQUAL(a, b) ((a) == (b)) #define REORDER_WAIT_TIME (50) /* (ms) */ #define RXDESC_SIZE 24 diff --git a/drivers/staging/rtl8188eu/include/rtw_security.h b/drivers/staging/rtl8188eu/include/rtw_security.h index 7100d6b..988e0f4 100644 --- a/drivers/staging/rtl8188eu/include/rtw_security.h +++ b/drivers/staging/rtl8188eu/include/rtw_security.h @@ -281,8 +281,8 @@ static const unsigned long K[64] = { #define RORc(x, y) \ (((((unsigned long)(x) & 0xFFFFFFFFUL) >> (unsigned long)((y)&31)) | \ ((unsigned long)(x) << (unsigned long)(32-((y)&31)))) & 0xFFFFFFFFUL) -#define Ch(x, y, z) (z ^ (x & (y ^ z))) -#define Maj(x, y, z) (((x | y) & z) | (x & y)) +#define Ch(x, y, z) ((z) ^ ((x) & ((y) ^ (z)))) +#define Maj(x, y, z) ((((x) | (y)) & (z)) | ((x) & (y))) #define S(x, n) RORc((x), (n)) #define R(x, n) (((x)&0xFFFFFFFFUL)>>(n)) #define Sigma0(x) (S(x, 2) ^ S(x, 13) ^ S(x, 22)) diff --git a/drivers/staging/rtl8188eu/include/rtw_xmit.h b/drivers/staging/rtl8188eu/include/rtw_xmit.h index dd6b7a9..4dad639 100644 --- a/drivers/staging/rtl8188eu/include/rtw_xmit.h +++ b/drivers/staging/rtl8188eu/include/rtw_xmit.h @@ -50,7 +50,7 @@ do {\ pattrib_iv[0] = dot11txpn._byte_.TSC0;\ pattrib_iv[1] = dot11txpn._byte_.TSC1;\ pattrib_iv[2] = dot11txpn._byte_.TSC2;\ - pattrib_iv[3] = ((keyidx & 0x3)<<6);\ + pattrib_iv[3] = (((keyidx) & 0x3) << 6);\ dot11txpn.val = (dot11txpn.val == 0xffffff) ? 0 : (dot11txpn.val+1);\ } while (0) diff --git a/drivers/staging/rtl8188eu/include/sta_info.h b/drivers/staging/rtl8188eu/include/sta_info.h index 42a03512..1c63c34 100644 --- a/drivers/staging/rtl8188eu/include/sta_info.h +++ b/drivers/staging/rtl8188eu/include/sta_info.h @@ -348,7 +348,7 @@ static inline u32 wifi_mac_hash(u8 *mac) u32 _rtw_init_sta_priv(struct sta_priv *pstapriv); u32 _rtw_free_sta_priv(struct sta_priv *pstapriv); -#define stainfo_offset_valid(offset) (offset < NUM_STA && offset >= 0) +#define stainfo_offset_valid(offset) ((offset) < NUM_STA && (offset) >= 0) int rtw_stainfo_offset(struct sta_priv *stapriv, struct sta_info *sta); struct sta_info *rtw_get_stainfo_by_offset(struct sta_priv *stapriv, int off); diff --git a/drivers/staging/rtl8188eu/include/wifi.h b/drivers/staging/rtl8188eu/include/wifi.h index cb46d35..827ea67 100644 --- a/drivers/staging/rtl8188eu/include/wifi.h +++ b/drivers/staging/rtl8188eu/include/wifi.h @@ -232,7 +232,7 @@ enum WIFI_REG_DOMAIN { do { \ *(__le16 *)((size_t)(pbuf) + 22) = \ ((*(__le16 *)((size_t)(pbuf) + 22)) & cpu_to_le16((unsigned short)0x000f)) | \ - cpu_to_le16((unsigned short)(0xfff0 & (num << 4))); \ + cpu_to_le16((unsigned short)(0xfff0 & ((num) << 4))); \ } while (0) #define SetDuration(pbuf, dur) \ @@ -240,15 +240,15 @@ enum WIFI_REG_DOMAIN { #define SetPriority(pbuf, tid) \ - *(__le16 *)(pbuf) |= cpu_to_le16(tid & 0xf) + *(__le16 *)(pbuf) |= cpu_to_le16((tid) & 0xf) #define GetPriority(pbuf) ((le16_to_cpu(*(__le16 *)(pbuf))) & 0xf) #define SetEOSP(pbuf, eosp) \ - *(__le16 *)(pbuf) |= cpu_to_le16((eosp & 1) << 4) + *(__le16 *)(pbuf) |= cpu_to_le16(((eosp) & 1) << 4) #define SetAckpolicy(pbuf, ack) \ - *(__le16 *)(pbuf) |= cpu_to_le16((ack & 3) << 5) + *(__le16 *)(pbuf) |= cpu_to_le16(((ack) & 3) << 5) #define GetAckpolicy(pbuf) (((le16_to_cpu(*(__le16 *)pbuf)) >> 5) & 0x3) -- 2.1.4 _______________________________________________ devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxx http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel