[v2,4/7] net/bnx2x: remove 'typedef int bool'
diff mbox series

Message ID 20200102174838.12908-5-dharmik.thakkar@arm.com
State Superseded, archived
Delegated to: Ferruh Yigit
Headers show
Series
  • remove 'typedef int bool'
Related show

Checks

Context Check Description
ci/Intel-compilation fail Compilation issues
ci/checkpatch success coding style OK

Commit Message

Dharmik Thakkar Jan. 2, 2020, 5:48 p.m. UTC
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(-)

Patch
diff mbox series

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)
 {