[dpdk-dev] [PATCH 2/2] ethdev: make rte_eth_is_valid_owner_id return bool

Matan Azrad matan at mellanox.com
Tue Aug 21 12:20:43 CEST 2018



From: Stephen Hemminger
> Function is boolean so use that.

Ethdev is not using bool type, see also:
rte_eth_dev_is_valid_port
rte_eth_dev_is_removed
rte_eth_dev_pool_ops_supported

I think it should be a full solution to all.
 
> Signed-off-by: Stephen Hemminger <sthemmin at microsoft.com>
> ---
>  lib/librte_ethdev/rte_ethdev.c | 8 +++-----
>  1 file changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c
> index f09bf8bc8b01..f0336736b7c1 100644
> --- a/lib/librte_ethdev/rte_ethdev.c
> +++ b/lib/librte_ethdev/rte_ethdev.c
> @@ -389,13 +389,11 @@ rte_eth_dev_is_valid_port(uint16_t port_id)
>  		return 1;
>  }
> 
> -static int
> +static bool
>  rte_eth_is_valid_owner_id(uint64_t owner_id)  {
> -	if (owner_id == RTE_ETH_DEV_NO_OWNER ||
> -	    rte_eth_dev_shared_data->next_owner_id <= owner_id)
> -		return 0;
> -	return 1;
> +	return !(owner_id == RTE_ETH_DEV_NO_OWNER ||
> +		 rte_eth_dev_shared_data->next_owner_id <= owner_id);
>  }
> 
>  uint64_t
> --
> 2.18.0



More information about the dev mailing list