DPDK-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: David Marchand <david.marchand@redhat.com>
To: dev@dpdk.org
Subject: [PATCH] dev: hide internal type for device comparison
Date: Mon,  6 Jul 2026 17:06:36 +0200	[thread overview]
Message-ID: <20260706150636.839560-1-david.marchand@redhat.com> (raw)

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@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


             reply	other threads:[~2026-07-06 15:06 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-06 15:06 David Marchand [this message]
2026-07-07 11:04 ` [PATCH] dev: hide internal type for device comparison Bruce Richardson
2026-07-08 12:53   ` David Marchand

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260706150636.839560-1-david.marchand@redhat.com \
    --to=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox