[API-NEXT,09/21] drv: driver: adding device query function

Message ID 1487768164-43184-10-git-send-email-christophe.milard@linaro.org
State Superseded
Headers show
Series
  • driver items registration and probing
Related show

Commit Message

Christophe Milard Feb. 22, 2017, 12:55 p.m.
Adding a function for querying a list of devices: this function may be
used by enumerators to query for the list of their registered devices
or for a subset of them.
Note that this function returns a malloc'd list of devices which is to
be freed by the caller.

Signed-off-by: Christophe Milard <christophe.milard@linaro.org>

---
 include/odp/drv/spec/driver.h | 12 ++++++++++++
 1 file changed, 12 insertions(+)

-- 
2.7.4

Patch hide | download patch | download mbox

diff --git a/include/odp/drv/spec/driver.h b/include/odp/drv/spec/driver.h
index 21a5fe1..abac138 100644
--- a/include/odp/drv/spec/driver.h
+++ b/include/odp/drv/spec/driver.h
@@ -387,6 +387,18 @@  int odpdrv_device_destroy(odpdrv_device_t dev,
 /** The callback function must be called by the current ODP thread */
 #define ODPDRV_DEV_DESTROY_IMMEDIATE	0x00000001
 
+/** query for a list of devices
+ * Enumerators are responsable for device creation and destruction.
+ * Upon request, ODP can build a list of devices belonging to a given enumerator
+ * and possibly having a specific address.
+ * This function builds this list.
+ * @param enumr The enumerator which created the device
+ * @param address The device address (or NULL if don't care)
+ * @return A malloc'd ODPDRV_DEVICE_INVALID terminated array of odpdrv_device_t
+ *         This array MUST BE FREED by the caller!
+ */
+odpdrv_device_t *odpdrv_device_query(odpdrv_enumr_t enumr, const char *address);
+
 /**
 * Register an devio.
 * Each devio calls this function at init time.