diff mbox series

[v2,6/7] net/fm10k: remove 'typedef int bool'

Message ID 20200102174838.12908-7-dharmik.thakkar@arm.com (mailing list archive)
State Superseded, archived
Delegated to: Ferruh Yigit
Headers show
Series remove 'typedef int bool' | expand

Checks

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

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/fm10k/base/fm10k_osdep.h | 8 +-------
 drivers/net/fm10k/fm10k_ethdev.c     | 6 +++---
 2 files changed, 4 insertions(+), 10 deletions(-)

Comments

Xiao Wang Jan. 3, 2020, 1:34 a.m. UTC | #1
Hi,

> -----Original Message-----
> From: Dharmik Thakkar <dharmik.thakkar@arm.com>
> Sent: Friday, January 3, 2020 1:49 AM
> To: Zhang, Qi Z <qi.z.zhang@intel.com>; Wang, Xiao W
> <xiao.w.wang@intel.com>
> Cc: dev@dpdk.org; Dharmik Thakkar <dharmik.thakkar@arm.com>
> Subject: [PATCH v2 6/7] net/fm10k: remove 'typedef int bool'
> 
> 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/fm10k/base/fm10k_osdep.h | 8 +-------
>  drivers/net/fm10k/fm10k_ethdev.c     | 6 +++---
>  2 files changed, 4 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/net/fm10k/base/fm10k_osdep.h
> b/drivers/net/fm10k/base/fm10k_osdep.h
> index 3b6298010da5..019fba5e2534 100644
> --- a/drivers/net/fm10k/base/fm10k_osdep.h
> +++ b/drivers/net/fm10k/base/fm10k_osdep.h
> @@ -6,6 +6,7 @@
>  #define _FM10K_OSDEP_H_
> 
>  #include <stdint.h>
> +#include <stdbool.h>
>  #include <string.h>
>  #include <rte_atomic.h>
>  #include <rte_byteorder.h>
> @@ -32,12 +33,6 @@
> 
>  #define FALSE      0
>  #define TRUE       1
> -#ifndef false
> -#define false      FALSE
> -#endif
> -#ifndef true
> -#define true       TRUE
> -#endif
> 
>  typedef uint8_t    u8;
>  typedef int8_t     s8;
> @@ -47,7 +42,6 @@ typedef uint32_t   u32;
>  typedef int32_t    s32;
>  typedef int64_t    s64;
>  typedef uint64_t   u64;
> -typedef int        bool;
> 
>  #ifndef __le16
>  #define __le16     u16
> diff --git a/drivers/net/fm10k/fm10k_ethdev.c
> b/drivers/net/fm10k/fm10k_ethdev.c
> index 407baa16c364..581c690b1842 100644
> --- a/drivers/net/fm10k/fm10k_ethdev.c
> +++ b/drivers/net/fm10k/fm10k_ethdev.c
> @@ -3210,19 +3210,19 @@ eth_fm10k_dev_init(struct rte_eth_dev *dev)
> 
>  	/* Make sure Switch Manager is ready before going forward. */
>  	if (hw->mac.type == fm10k_mac_pf) {
> -		int switch_ready = 0;
> +		bool switch_ready = false;
> 
>  		for (i = 0; i < MAX_QUERY_SWITCH_STATE_TIMES; i++) {
>  			fm10k_mbx_lock(hw);
>  			hw->mac.ops.get_host_state(hw, &switch_ready);
>  			fm10k_mbx_unlock(hw);
> -			if (switch_ready)
> +			if (switch_ready == true)
>  				break;
>  			/* Delay some time to acquire async LPORT_MAP info.
> */
>  			rte_delay_us(WAIT_SWITCH_MSG_US);
>  		}
> 
> -		if (switch_ready == 0) {
> +		if (switch_ready == false) {
>  			PMD_INIT_LOG(ERR, "switch is not ready");
>  			return -1;
>  		}
> --
> 2.17.1

Acked-by: Xiao Wang <xiao.w.wang@intel.com>

BRs,
Xiao
diff mbox series

Patch

diff --git a/drivers/net/fm10k/base/fm10k_osdep.h b/drivers/net/fm10k/base/fm10k_osdep.h
index 3b6298010da5..019fba5e2534 100644
--- a/drivers/net/fm10k/base/fm10k_osdep.h
+++ b/drivers/net/fm10k/base/fm10k_osdep.h
@@ -6,6 +6,7 @@ 
 #define _FM10K_OSDEP_H_
 
 #include <stdint.h>
+#include <stdbool.h>
 #include <string.h>
 #include <rte_atomic.h>
 #include <rte_byteorder.h>
@@ -32,12 +33,6 @@ 
 
 #define FALSE      0
 #define TRUE       1
-#ifndef false
-#define false      FALSE
-#endif
-#ifndef true
-#define true       TRUE
-#endif
 
 typedef uint8_t    u8;
 typedef int8_t     s8;
@@ -47,7 +42,6 @@  typedef uint32_t   u32;
 typedef int32_t    s32;
 typedef int64_t    s64;
 typedef uint64_t   u64;
-typedef int        bool;
 
 #ifndef __le16
 #define __le16     u16
diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c
index 407baa16c364..581c690b1842 100644
--- a/drivers/net/fm10k/fm10k_ethdev.c
+++ b/drivers/net/fm10k/fm10k_ethdev.c
@@ -3210,19 +3210,19 @@  eth_fm10k_dev_init(struct rte_eth_dev *dev)
 
 	/* Make sure Switch Manager is ready before going forward. */
 	if (hw->mac.type == fm10k_mac_pf) {
-		int switch_ready = 0;
+		bool switch_ready = false;
 
 		for (i = 0; i < MAX_QUERY_SWITCH_STATE_TIMES; i++) {
 			fm10k_mbx_lock(hw);
 			hw->mac.ops.get_host_state(hw, &switch_ready);
 			fm10k_mbx_unlock(hw);
-			if (switch_ready)
+			if (switch_ready == true)
 				break;
 			/* Delay some time to acquire async LPORT_MAP info. */
 			rte_delay_us(WAIT_SWITCH_MSG_US);
 		}
 
-		if (switch_ready == 0) {
+		if (switch_ready == false) {
 			PMD_INIT_LOG(ERR, "switch is not ready");
 			return -1;
 		}