Skip to contentSkip to conversation

octeontx2: Remove unnecessary ternary operators

PATCH Applied Ruan Jinjie 3 participants 3 messages Aug 1, 2023 – Aug 2, 2023

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 octeontx2: Remove unnecessary ternary operators

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

---
v2:
- Fix the subject prefix and commit message issue.

---
 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(-)
drivers/net/ethernet/marvell/octeontx2/af/ptp.c +2 -2
index 0ee420a489fc..c55c2c441a1a 100644
@@ -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)
drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c +1 -1
index 9551b422622a..61f62a6ec662 100644
@@ -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
Signature · 1 line
2.34.1
maintainer Reviewed-by on v2 1/1
#1 lore raw
Quoted 7 lines

External Email

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

Quoted 6 lines

---
v2:
- Fix the subject prefix and commit message issue.
---

#2 lore raw
In reply to Ruan Jinjie
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Quoted 8 lines · On Tue, 1 Aug 2023 19:26:38 +0800 you wrote:

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

[...]

Here is the summary with links:
- [net-next,v2] octeontx2: Remove unnecessary ternary operators

    https://git.kernel.org/netdev/net-next/c/c7606d49e609

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html