[dpdk-dev] [PATCH v5 02/12] bus: add device iterator method

Bruce Richardson bruce.richardson at intel.com
Mon Jun 26 18:20:37 CEST 2017


On Mon, Jun 26, 2017 at 02:22:00AM +0200, Gaetan Rivet wrote:
> From: Jan Blunck <jblunck at infradead.org>
> 
> Signed-off-by: Jan Blunck <jblunck at infradead.org>
> Signed-off-by: Gaetan Rivet <gaetan.rivet at 6wind.com>
> ---
>  lib/librte_eal/common/include/rte_bus.h | 19 +++++++++++++++++++
>  lib/librte_eal/common/include/rte_dev.h | 21 +++++++++++++++++++++
>  2 files changed, 40 insertions(+)
> 
> diff --git a/lib/librte_eal/common/include/rte_bus.h b/lib/librte_eal/common/include/rte_bus.h
> index ecf839b..5efb76e 100644
> --- a/lib/librte_eal/common/include/rte_bus.h
> +++ b/lib/librte_eal/common/include/rte_bus.h
> @@ -82,6 +82,24 @@ typedef int (*rte_bus_scan_t)(void);
>  typedef int (*rte_bus_probe_t)(void);
>  
>  /**
> + * Device iterator to find a device on a bus.
> + *
> + * This function returns an rte_device if one of those held by the bus
> + * matches the data passed as parameter.
> + *
> + * @param cmp
> + *	Comparison function.
> + *
> + * @param data
> + *	Data to compare each device against.
> + *
> + * @return
> + *	The first device matching the data, NULL if none exists.
> + */
> +typedef struct rte_device * (*rte_bus_find_device_t)(rte_dev_cmp_t cmp,
> +						     const void *data);
> +
> +/**

The bus find function takes a third, start, parameter. Is it worthwhile
including such a parameter here, for consistency sake if nothing else?

Otherwise:

Acked-by: Bruce Richardson <bruce.richardson at intel.com>


More information about the dev mailing list