All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Staging: rtl8192e: Remove ternary operator
@ 2016-10-08 18:28 Bhumika Goyal
  2016-10-09  6:00 ` [Outreachy kernel] " Julia Lawall
  2016-10-09 14:26 ` Greg KH
  0 siblings, 2 replies; 8+ messages in thread
From: Bhumika Goyal @ 2016-10-08 18:28 UTC (permalink / raw)
  To: outreachy-kernel, gregkh; +Cc: Bhumika Goyal

Relational and logical operators evaluate to either true or false.
Explicit conversion is not needed so remove the ternary operator.
Done using coccinelle:

@r@
expression A,B;
symbol true,false;
binary operator b = {==,!=,&&,||,>=,<=,>,<};
@@
- (A b B) ? true : false
+ A b B

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
---
 drivers/staging/rtl8192e/rtl819x_HTProc.c | 12 ++++--------
 drivers/staging/rtl8192e/rtllib.h         |  2 +-
 2 files changed, 5 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/rtl8192e/rtl819x_HTProc.c b/drivers/staging/rtl8192e/rtl819x_HTProc.c
index dd9c0c8..8cd51a9 100644
--- a/drivers/staging/rtl8192e/rtl819x_HTProc.c
+++ b/drivers/staging/rtl8192e/rtl819x_HTProc.c
@@ -558,19 +558,15 @@ void HTOnAssocRsp(struct rtllib_device *ieee)
 #endif
 	HTSetConnectBwMode(ieee, (enum ht_channel_width)(pPeerHTCap->ChlWidth),
 			  (enum ht_extchnl_offset)(pPeerHTInfo->ExtChlOffset));
-	pHTInfo->bCurTxBW40MHz = ((pPeerHTInfo->RecommemdedTxWidth == 1) ?
-				 true : false);
+	pHTInfo->bCurTxBW40MHz = (pPeerHTInfo->RecommemdedTxWidth == 1);
 
 	pHTInfo->bCurShortGI20MHz = ((pHTInfo->bRegShortGI20MHz) ?
-				    ((pPeerHTCap->ShortGI20Mhz == 1) ?
-				    true : false) : false);
+				    (pPeerHTCap->ShortGI20Mhz == 1) : false);
 	pHTInfo->bCurShortGI40MHz = ((pHTInfo->bRegShortGI40MHz) ?
-				     ((pPeerHTCap->ShortGI40Mhz == 1) ?
-				     true : false) : false);
+				     (pPeerHTCap->ShortGI40Mhz == 1) : false);
 
 	pHTInfo->bCurSuppCCK = ((pHTInfo->bRegSuppCCK) ?
-			       ((pPeerHTCap->DssCCk == 1) ? true :
-			       false) : false);
+			       (pPeerHTCap->DssCCk == 1) : false);
 
 
 	pHTInfo->bCurrent_AMSDU_Support = pHTInfo->bAMSDU_Support;
diff --git a/drivers/staging/rtl8192e/rtllib.h b/drivers/staging/rtl8192e/rtllib.h
index b895a53..f2c28f3 100644
--- a/drivers/staging/rtl8192e/rtllib.h
+++ b/drivers/staging/rtl8192e/rtllib.h
@@ -464,7 +464,7 @@ struct ieee_param {
 #define RTLLIB_QCTL_TID	      0x000F
 
 #define	FC_QOS_BIT					BIT7
-#define IsDataFrame(pdu)	(((pdu[0] & 0x0C) == 0x08) ? true : false)
+#define IsDataFrame(pdu)	((pdu[0] & 0x0C) == 0x08)
 #define	IsLegacyDataFrame(pdu)	(IsDataFrame(pdu) && (!(pdu[0]&FC_QOS_BIT)))
 #define IsQoSDataFrame(pframe)			\
 	((*(u16 *)pframe&(RTLLIB_STYPE_QOS_DATA|RTLLIB_FTYPE_DATA)) ==	\
-- 
1.9.1



^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2016-10-09 16:21 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-08 18:28 [PATCH] Staging: rtl8192e: Remove ternary operator Bhumika Goyal
2016-10-09  6:00 ` [Outreachy kernel] " Julia Lawall
2016-10-09  6:38   ` Bhumika Goyal
2016-10-09 10:51     ` Julia Lawall
2016-10-09 14:26 ` Greg KH
2016-10-09 14:36   ` [Outreachy kernel] " Julia Lawall
2016-10-09 14:46     ` Greg KH
2016-10-09 16:21       ` Bhumika Goyal

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.