[PATCH -next] octeontx2: Remove unnecessary ternary operators

Subsystems: marvell octeontx2 physical function driver, marvell octeontx2 rvu admin function driver, networking drivers, the rest

STALE1139d

3 messages, 2 authors, 2023-08-01 · open the first message on its own page

[PATCH -next] octeontx2: Remove unnecessary ternary operators

From: Ruan Jinjie <hidden>
Date: 2023-08-01 02:45:17

Ther are a little ternary operators, the true or false judgement
of which is unnecessary in C language semantics. So remove it
to clean Code.

Signed-off-by: Ruan Jinjie <redacted>
---
 drivers/net/ethernet/marvell/octeontx2/af/ptp.c      | 4 ++--
 drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/marvell/octeontx2/af/ptp.c b/drivers/net/ethernet/marvell/octeontx2/af/ptp.c
index 0ee420a489fc..c55c2c441a1a 100644
--- a/drivers/net/ethernet/marvell/octeontx2/af/ptp.c
+++ b/drivers/net/ethernet/marvell/octeontx2/af/ptp.c
@@ -61,12 +61,12 @@ static const struct pci_device_id ptp_id_table[];
 
 static bool is_ptp_dev_cnf10kb(struct ptp *ptp)
 {
-	return (ptp->pdev->subsystem_device == PCI_SUBSYS_DEVID_CNF10K_B_PTP) ? true : false;
+	return ptp->pdev->subsystem_device == PCI_SUBSYS_DEVID_CNF10K_B_PTP;
 }
 
 static bool is_ptp_dev_cn10k(struct ptp *ptp)
 {
-	return (ptp->pdev->device == PCI_DEVID_CN10K_PTP) ? true : false;
+	return ptp->pdev->device == PCI_DEVID_CN10K_PTP;
 }
 
 static bool cn10k_ptp_errata(struct ptp *ptp)
diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c
index 9551b422622a..61f62a6ec662 100644
--- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c
+++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c
@@ -2027,7 +2027,7 @@ u16 otx2_select_queue(struct net_device *netdev, struct sk_buff *skb,
 #endif
 	int txq;
 
-	qos_enabled = (netdev->real_num_tx_queues > pf->hw.tx_queues) ? true : false;
+	qos_enabled = netdev->real_num_tx_queues > pf->hw.tx_queues;
 	if (unlikely(qos_enabled)) {
 		/* This smp_load_acquire() pairs with smp_store_release() in
 		 * otx2_qos_root_add() called from htb offload root creation
-- 
2.34.1

Re: [PATCH -next] octeontx2: Remove unnecessary ternary operators

From: Simon Horman <horms@kernel.org>
Date: 2023-08-01 10:15:06

On Tue, Aug 01, 2023 at 10:44:13AM +0800, Ruan Jinjie wrote:
Ther are a little ternary operators, the true or false judgement
nit: Ther -> There
of which is unnecessary in C language semantics. So remove it
to clean Code.
The target tree of this patch should be 'net-next'.

	Subject: [PATCH net-next] ...
Signed-off-by: Ruan Jinjie <redacted>
Otherwise this looks good to me.

Reviewed-by: Simon Horman <horms@kernel.org>

Re: [PATCH -next] octeontx2: Remove unnecessary ternary operators

From: Ruan Jinjie <hidden>
Date: 2023-08-01 10:57:20


On 2023/8/1 18:15, Simon Horman wrote:
On Tue, Aug 01, 2023 at 10:44:13AM +0800, Ruan Jinjie wrote:
quoted
Ther are a little ternary operators, the true or false judgement
nit: Ther -> There
quoted
of which is unnecessary in C language semantics. So remove it
to clean Code.
The target tree of this patch should be 'net-next'.

	Subject: [PATCH net-next] ...
Thank you! I'll fix it in v2.
quoted
Signed-off-by: Ruan Jinjie <redacted>
Otherwise this looks good to me.

Reviewed-by: Simon Horman <horms@kernel.org>
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help