From: Christophe Milard <[email protected]> trivial tests for function odpdrv_device_set_data() and odpdrv_device_get_data().
Signed-off-by: Christophe Milard <[email protected]> --- /** Email created from pull request 16 (heyi-linaro:driver-framework) ** https://github.com/Linaro/odp/pull/16 ** Patch: https://github.com/Linaro/odp/pull/16.patch ** Base sha: bac3806356694060d30bf3c83e4133410fecd9ab ** Merge commit sha: 8038f288f85db54e1a242e91ded59675313317bf **/ test/common_plat/validation/drv/drvdriver/drvdriver_driver.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/common_plat/validation/drv/drvdriver/drvdriver_driver.c b/test/common_plat/validation/drv/drvdriver/drvdriver_driver.c index d90aa56..edcb0f4 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);
