diff mbox series

[API-NEXT,21/21] test: drv: test for setting and retrieving driver's data

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

Commit Message

Christophe Milard Feb. 22, 2017, 12:56 p.m. UTC
trivial tests for function odpdrv_device_set_data() and
odpdrv_device_get_data().

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

---
 test/common_plat/validation/drv/drvdriver/drvdriver_driver.c | 3 +++
 1 file changed, 3 insertions(+)

-- 
2.7.4
diff mbox series

Patch

diff --git a/test/common_plat/validation/drv/drvdriver/drvdriver_driver.c b/test/common_plat/validation/drv/drvdriver/drvdriver_driver.c
index c293b06..4143acd 100644
--- a/test/common_plat/validation/drv/drvdriver/drvdriver_driver.c
+++ b/test/common_plat/validation/drv/drvdriver/drvdriver_driver.c
@@ -380,6 +380,8 @@  static int driver1_probe(odpdrv_device_t dev, odpdrv_devio_t devio, int idx)
 		if (dev == E1_devs[i]) {
 			driver1_probed_index |= (1 << i);
 			dev_found = 1;
+			/* just set dev index as driver data */
+			odpdrv_device_set_data(dev, (void *)(uintptr_t)i);
 		}
 	}
 	CU_ASSERT(dev_found);
@@ -430,6 +432,7 @@  static int driver1_unbind(odpdrv_device_t dev,
 			  void (*callback)(odpdrv_device_t dev),
 			  uint32_t flags)
 {
+	CU_ASSERT(E1_devs[(uintptr_t)odpdrv_device_get_data(dev)] == dev);
 	CU_ASSERT(dev != ODPDRV_DEVICE_INVALID);
 	CU_ASSERT(flags == ODPDRV_DRV_UNBIND_IMMEDIATE);
 	callback(dev);