[API-NEXT,12/21] drv: driver: adding a probe and remove callback for devio

Message ID 1487768164-43184-13-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.
Needed to delete the resources needed for the devio. That is possibly
the memory allocated for its "ops" part if it was allocated. May be NULL
if nothing needs to be done at devio deletion time.

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

---
 include/odp/drv/spec/driver.h | 18 ++++++++++++++++++
 1 file changed, 18 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 abac138..0b62c1b 100644
--- a/include/odp/drv/spec/driver.h
+++ b/include/odp/drv/spec/driver.h
@@ -269,6 +269,24 @@  struct odpdrv_devio_param_t {
 	char enumr_api_name[ODPDRV_NAME_SIZE];
 	uint32_t enumr_api_version; /**<< required enumerator API version */
 
+	/** Probe function:
+	 * Tell whether this devio can handle the given device.
+	 * The devio is hence given a chance to reject a given device for
+	 * any reason. No binding occurs here. binding occurs when the
+	 * driver is probed.
+	 * returns 0 if this devio can handle the given device, or a negative
+	 * value if not.
+	 * If left to NULL, a 0 returned value is assumed
+	 */
+	int (*probe)(odpdrv_device_t dev);
+
+	/** Remove function:
+	 * Should destroy the memory allocated for ops and anything else
+	 * under it, or any resource for this devio.
+	 * Returns 0 on success or a negative value on error.
+	 */
+	int (*remove)(void);
+
 	/** Ops
 	 * Pointer to a devio ops structure (specific to each devio)
 	 */