[PATCH] dev: hide internal type for device comparison
David Marchand
david.marchand at redhat.com
Mon Jul 6 17:06:36 CEST 2026
rte_dev_cmp_t is a type used only in bus operations.
Since no public API references it, remove it from exported types.
Thanks to this, we can remove the dependency of bus_driver.h to
rte_dev.h.
Signed-off-by: David Marchand <david.marchand at redhat.com>
---
app/test/test_vdev.c | 1 +
lib/eal/include/bus_driver.h | 24 +++++++++++++++++++++++-
lib/eal/include/rte_dev.h | 21 ---------------------
3 files changed, 24 insertions(+), 22 deletions(-)
diff --git a/app/test/test_vdev.c b/app/test/test_vdev.c
index c82d996404..c300976ace 100644
--- a/app/test/test_vdev.c
+++ b/app/test/test_vdev.c
@@ -7,6 +7,7 @@
#include <string.h>
#include <rte_common.h>
+#include <rte_dev.h>
#include <rte_kvargs.h>
#include <bus_driver.h>
#include <rte_bus_vdev.h>
diff --git a/lib/eal/include/bus_driver.h b/lib/eal/include/bus_driver.h
index 4f6521c87f..fa4d711a90 100644
--- a/lib/eal/include/bus_driver.h
+++ b/lib/eal/include/bus_driver.h
@@ -7,7 +7,6 @@
#include <rte_bus.h>
#include <rte_compat.h>
-#include <rte_dev.h>
#include <rte_eal.h>
#include <rte_tailq.h>
@@ -15,8 +14,10 @@
extern "C" {
#endif
+struct rte_dev_iterator;
struct rte_devargs;
struct rte_device;
+struct rte_driver;
/** Double linked list of buses */
RTE_TAILQ_HEAD(rte_bus_list, rte_bus);
@@ -49,6 +50,27 @@ typedef int (*rte_bus_scan_t)(void);
*/
typedef int (*rte_bus_probe_t)(struct rte_bus *bus);
+/**
+ * Device comparison function.
+ *
+ * This type of function is used to compare an rte_device with arbitrary
+ * data.
+ *
+ * @param dev
+ * Device handle.
+ *
+ * @param data
+ * Data to compare against. The type of this parameter is determined by
+ * the kind of comparison performed by the function.
+ *
+ * @return
+ * 0 if the device matches the data.
+ * !0 if the device does not match.
+ * <0 if ordering is possible and the device is lower than the data.
+ * >0 if ordering is possible and the device is greater than the data.
+ */
+typedef int (*rte_dev_cmp_t)(const struct rte_device *dev, const void *data);
+
/**
* Device iterator to find a device on a bus.
*
diff --git a/lib/eal/include/rte_dev.h b/lib/eal/include/rte_dev.h
index 7eca5e8cf2..12e205efa7 100644
--- a/lib/eal/include/rte_dev.h
+++ b/lib/eal/include/rte_dev.h
@@ -211,27 +211,6 @@ int rte_eal_hotplug_remove(const char *busname, const char *devname);
*/
int rte_dev_remove(struct rte_device *dev);
-/**
- * Device comparison function.
- *
- * This type of function is used to compare an rte_device with arbitrary
- * data.
- *
- * @param dev
- * Device handle.
- *
- * @param data
- * Data to compare against. The type of this parameter is determined by
- * the kind of comparison performed by the function.
- *
- * @return
- * 0 if the device matches the data.
- * !0 if the device does not match.
- * <0 if ordering is possible and the device is lower than the data.
- * >0 if ordering is possible and the device is greater than the data.
- */
-typedef int (*rte_dev_cmp_t)(const struct rte_device *dev, const void *data);
-
/**
* Iteration context.
*
--
2.54.0
More information about the dev
mailing list