DPDK patches and discussions
 help / color / mirror / Atom feed
From: Dharmik Thakkar <dharmik.thakkar@arm.com>
To: Rasesh Mody <rmody@marvell.com>, Shahed Shaikh <shshaikh@marvell.com>
Cc: dev@dpdk.org, nd@arm.com, Dharmik Thakkar <dharmik.thakkar@arm.com>
Subject: [dpdk-dev] [PATCH v3 4/7] net/bnx2x: remove 'typedef int bool'
Date: Fri, 10 Jan 2020 14:51:49 -0600	[thread overview]
Message-ID: <20200110205152.30966-5-dharmik.thakkar@arm.com> (raw)
In-Reply-To: <20200110205152.30966-1-dharmik.thakkar@arm.com>

Replace 'typedef int bool' with 'stdbool.h' to avoid possible
multiple definitions of 'bool'.

Signed-off-by: Dharmik Thakkar <dharmik.thakkar@arm.com>
Reviewed-by: Phil Yang <phil.yang@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
---
 drivers/net/bnx2x/bnx2x_ethdev.h |  4 +--
 drivers/net/bnx2x/ecore_sp.c     | 46 ++++++++++++++++----------------
 2 files changed, 24 insertions(+), 26 deletions(-)

diff --git a/drivers/net/bnx2x/bnx2x_ethdev.h b/drivers/net/bnx2x/bnx2x_ethdev.h
index bd3ef143b63d..f712bb3e84c6 100644
--- a/drivers/net/bnx2x/bnx2x_ethdev.h
+++ b/drivers/net/bnx2x/bnx2x_ethdev.h
@@ -15,6 +15,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <stdbool.h>
 #include <errno.h>
 #include <stdint.h>
 #include <string.h>
@@ -47,9 +48,6 @@
 #define FALSE               0
 #define TRUE                1
 
-typedef int bool;
-#define false               0
-#define true                1
 #define min(a,b)        RTE_MIN(a,b)
 
 #define mb()    rte_mb()
diff --git a/drivers/net/bnx2x/ecore_sp.c b/drivers/net/bnx2x/ecore_sp.c
index b9bca9115e60..00c33a317512 100644
--- a/drivers/net/bnx2x/ecore_sp.c
+++ b/drivers/net/bnx2x/ecore_sp.c
@@ -245,7 +245,7 @@ static struct ecore_exeq_elem *ecore_exe_queue_alloc_elem(struct
 }
 
 /************************ raw_obj functions ***********************************/
-static int ecore_raw_check_pending(struct ecore_raw_obj *o)
+static bool ecore_raw_check_pending(struct ecore_raw_obj *o)
 {
 	/*
 	 * !! converts the value returned by ECORE_TEST_BIT such that it
@@ -328,7 +328,7 @@ static int ecore_raw_wait(struct bnx2x_softc *sc, struct ecore_raw_obj *raw)
 
 /***************** Classification verbs: Set/Del MAC/VLAN/VLAN-MAC ************/
 /* credit handling callbacks */
-static int ecore_get_cam_offset_mac(struct ecore_vlan_mac_obj *o, int *offset)
+static bool ecore_get_cam_offset_mac(struct ecore_vlan_mac_obj *o, int *offset)
 {
 	struct ecore_credit_pool_obj *mp = o->macs_pool;
 
@@ -337,7 +337,7 @@ static int ecore_get_cam_offset_mac(struct ecore_vlan_mac_obj *o, int *offset)
 	return mp->get_entry(mp, offset);
 }
 
-static int ecore_get_credit_mac(struct ecore_vlan_mac_obj *o)
+static bool ecore_get_credit_mac(struct ecore_vlan_mac_obj *o)
 {
 	struct ecore_credit_pool_obj *mp = o->macs_pool;
 
@@ -346,14 +346,14 @@ static int ecore_get_credit_mac(struct ecore_vlan_mac_obj *o)
 	return mp->get(mp, 1);
 }
 
-static int ecore_put_cam_offset_mac(struct ecore_vlan_mac_obj *o, int offset)
+static bool ecore_put_cam_offset_mac(struct ecore_vlan_mac_obj *o, int offset)
 {
 	struct ecore_credit_pool_obj *mp = o->macs_pool;
 
 	return mp->put_entry(mp, offset);
 }
 
-static int ecore_put_credit_mac(struct ecore_vlan_mac_obj *o)
+static bool ecore_put_credit_mac(struct ecore_vlan_mac_obj *o)
 {
 	struct ecore_credit_pool_obj *mp = o->macs_pool;
 
@@ -661,7 +661,7 @@ static struct ecore_vlan_mac_registry_elem *ecore_check_mac_del(struct bnx2x_sof
 }
 
 /* check_move() callback */
-static int ecore_check_move(struct bnx2x_softc *sc,
+static bool ecore_check_move(struct bnx2x_softc *sc,
 			    struct ecore_vlan_mac_obj *src_o,
 			    struct ecore_vlan_mac_obj *dst_o,
 			    union ecore_classification_ramrod_data *data)
@@ -686,7 +686,7 @@ static int ecore_check_move(struct bnx2x_softc *sc,
 	return TRUE;
 }
 
-static int ecore_check_move_always_err(__rte_unused struct bnx2x_softc *sc,
+static bool ecore_check_move_always_err(__rte_unused struct bnx2x_softc *sc,
 				       __rte_unused struct ecore_vlan_mac_obj
 				       *src_o, __rte_unused struct ecore_vlan_mac_obj
 				       *dst_o, __rte_unused union
@@ -713,7 +713,7 @@ static uint8_t ecore_vlan_mac_get_rx_tx_flag(struct ecore_vlan_mac_obj
 }
 
 void ecore_set_mac_in_nig(struct bnx2x_softc *sc,
-				 int add, unsigned char *dev_addr, int index)
+				 bool add, unsigned char *dev_addr, int index)
 {
 	uint32_t wb_data[2];
 	uint32_t reg_offset = ECORE_PORT_ID(sc) ? NIG_REG_LLH1_FUNC_MEM :
@@ -754,7 +754,7 @@ void ecore_set_mac_in_nig(struct bnx2x_softc *sc,
  *
  */
 static void ecore_vlan_mac_set_cmd_hdr_e2(struct ecore_vlan_mac_obj *o,
-					  int add, int opcode,
+					  bool add, int opcode,
 					  struct eth_classify_cmd_header
 					  *hdr)
 {
@@ -803,7 +803,7 @@ static void ecore_set_one_mac_e2(struct bnx2x_softc *sc,
 	    (struct eth_classify_rules_ramrod_data *)(raw->rdata);
 	int rule_cnt = rule_idx + 1, cmd = elem->cmd_data.vlan_mac.cmd;
 	union eth_classify_rule_cmd *rule_entry = &data->rules[rule_idx];
-	int add = (cmd == ECORE_VLAN_MAC_ADD) ? TRUE : FALSE;
+	bool add = (cmd == ECORE_VLAN_MAC_ADD) ? TRUE : FALSE;
 	unsigned long *vlan_mac_flags = &elem->cmd_data.vlan_mac.vlan_mac_flags;
 	uint8_t *mac = elem->cmd_data.vlan_mac.u.mac.mac;
 
@@ -3117,12 +3117,12 @@ static void ecore_mcast_set_sched(struct ecore_mcast_obj *o)
 	ECORE_SMP_MB_AFTER_CLEAR_BIT();
 }
 
-static int ecore_mcast_check_sched(struct ecore_mcast_obj *o)
+static bool ecore_mcast_check_sched(struct ecore_mcast_obj *o)
 {
 	return ! !ECORE_TEST_BIT(o->sched_state, o->raw.pstate);
 }
 
-static int ecore_mcast_check_pending(struct ecore_mcast_obj *o)
+static bool ecore_mcast_check_pending(struct ecore_mcast_obj *o)
 {
 	return o->raw.check_pending(&o->raw) || o->check_sched(o);
 }
@@ -3195,7 +3195,7 @@ void ecore_init_mcast_obj(struct bnx2x_softc *sc,
  * returns TRUE if (v + a) was less than u, and FALSE otherwise.
  *
  */
-static int __atomic_add_ifless(ecore_atomic_t * v, int a, int u)
+static bool __atomic_add_ifless(ecore_atomic_t *v, int a, int u)
 {
 	int c, old;
 
@@ -3223,7 +3223,7 @@ static int __atomic_add_ifless(ecore_atomic_t * v, int a, int u)
  * returns TRUE if (v - a) was more or equal than u, and FALSE
  * otherwise.
  */
-static int __atomic_dec_ifmoe(ecore_atomic_t * v, int a, int u)
+static bool __atomic_dec_ifmoe(ecore_atomic_t *v, int a, int u)
 {
 	int c, old;
 
@@ -3241,9 +3241,9 @@ static int __atomic_dec_ifmoe(ecore_atomic_t * v, int a, int u)
 	return TRUE;
 }
 
-static int ecore_credit_pool_get(struct ecore_credit_pool_obj *o, int cnt)
+static bool ecore_credit_pool_get(struct ecore_credit_pool_obj *o, int cnt)
 {
-	int rc;
+	bool rc;
 
 	ECORE_SMP_MB();
 	rc = __atomic_dec_ifmoe(&o->credit, cnt, 0);
@@ -3252,9 +3252,9 @@ static int ecore_credit_pool_get(struct ecore_credit_pool_obj *o, int cnt)
 	return rc;
 }
 
-static int ecore_credit_pool_put(struct ecore_credit_pool_obj *o, int cnt)
+static bool ecore_credit_pool_put(struct ecore_credit_pool_obj *o, int cnt)
 {
-	int rc;
+	bool rc;
 
 	ECORE_SMP_MB();
 
@@ -3276,14 +3276,14 @@ static int ecore_credit_pool_check(struct ecore_credit_pool_obj *o)
 	return cur_credit;
 }
 
-static int ecore_credit_pool_always_TRUE(__rte_unused struct
+static bool ecore_credit_pool_always_TRUE(__rte_unused struct
 					 ecore_credit_pool_obj *o,
 					 __rte_unused int cnt)
 {
 	return TRUE;
 }
 
-static int ecore_credit_pool_get_entry(struct ecore_credit_pool_obj *o,
+static bool ecore_credit_pool_get_entry(struct ecore_credit_pool_obj *o,
 				       int *offset)
 {
 	int idx, vec, i;
@@ -3312,7 +3312,7 @@ static int ecore_credit_pool_get_entry(struct ecore_credit_pool_obj *o,
 	return FALSE;
 }
 
-static int ecore_credit_pool_put_entry(struct ecore_credit_pool_obj *o,
+static bool ecore_credit_pool_put_entry(struct ecore_credit_pool_obj *o,
 				       int offset)
 {
 	if (offset < o->base_pool_offset)
@@ -3329,14 +3329,14 @@ static int ecore_credit_pool_put_entry(struct ecore_credit_pool_obj *o,
 	return TRUE;
 }
 
-static int ecore_credit_pool_put_entry_always_TRUE(__rte_unused struct
+static bool ecore_credit_pool_put_entry_always_TRUE(__rte_unused struct
 						   ecore_credit_pool_obj *o,
 						   __rte_unused int offset)
 {
 	return TRUE;
 }
 
-static int ecore_credit_pool_get_entry_always_TRUE(__rte_unused struct
+static bool ecore_credit_pool_get_entry_always_TRUE(__rte_unused struct
 						   ecore_credit_pool_obj *o,
 						   __rte_unused int *offset)
 {
-- 
2.17.1


  parent reply	other threads:[~2020-01-10 20:52 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-03 22:44 [dpdk-dev] [PATCH] net/ixgbe: avoid multpile definitions of 'bool' Dharmik Thakkar
2019-10-16  6:23 ` Ye Xiaolong
2019-10-16 16:22   ` Dharmik Thakkar
2020-01-02 17:48 ` [dpdk-dev] [PATCH v2 0/7] remove 'typedef int bool' Dharmik Thakkar
2020-01-02 17:48   ` [dpdk-dev] [PATCH v2 1/7] net/ixgbe: avoid multpile definitions of 'bool' Dharmik Thakkar
2020-01-10  9:22     ` Ferruh Yigit
2020-01-10 20:55       ` Dharmik Thakkar
2020-01-02 17:48   ` [dpdk-dev] [PATCH v2 2/7] net/cxgbe: remove 'typedef int bool' Dharmik Thakkar
2020-01-02 17:48   ` [dpdk-dev] [PATCH v2 3/7] net/vmxnet3: " Dharmik Thakkar
2020-01-02 19:53     ` Yong Wang
2020-01-02 17:48   ` [dpdk-dev] [PATCH v2 4/7] net/bnx2x: " Dharmik Thakkar
2020-01-02 17:48   ` [dpdk-dev] [PATCH v2 5/7] net/e1000: " Dharmik Thakkar
2020-01-02 17:48   ` [dpdk-dev] [PATCH v2 6/7] net/fm10k: " Dharmik Thakkar
2020-01-03  1:34     ` Wang, Xiao W
2020-01-02 17:48   ` [dpdk-dev] [PATCH v2 7/7] net/qede: " Dharmik Thakkar
2020-01-10 20:51   ` [dpdk-dev] [PATCH v3 0/7] " Dharmik Thakkar
2020-01-10 20:51     ` [dpdk-dev] [PATCH v3 1/7] net/ixgbe: avoid multpile definitions of 'bool' Dharmik Thakkar
2020-01-10 20:51     ` [dpdk-dev] [PATCH v3 2/7] net/cxgbe: remove 'typedef int bool' Dharmik Thakkar
2020-01-10 20:51     ` [dpdk-dev] [PATCH v3 3/7] net/vmxnet3: " Dharmik Thakkar
2020-01-10 20:51     ` Dharmik Thakkar [this message]
2020-01-10 20:51     ` [dpdk-dev] [PATCH v3 5/7] net/e1000: " Dharmik Thakkar
2020-01-10 20:51     ` [dpdk-dev] [PATCH v3 6/7] net/fm10k: " Dharmik Thakkar
2020-01-10 20:51     ` [dpdk-dev] [PATCH v3 7/7] net/qede: " Dharmik Thakkar
2020-01-13 11:14     ` [dpdk-dev] [PATCH v3 0/7] " Ferruh Yigit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200110205152.30966-5-dharmik.thakkar@arm.com \
    --to=dharmik.thakkar@arm.com \
    --cc=dev@dpdk.org \
    --cc=nd@arm.com \
    --cc=rmody@marvell.com \
    --cc=shshaikh@marvell.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).