summaryrefslogtreecommitdiff
path: root/test/dm/test-driver.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/dm/test-driver.c')
-rw-r--r--test/dm/test-driver.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/test/dm/test-driver.c b/test/dm/test-driver.c
index 63dc9d335ae..02cb974b0f7 100644
--- a/test/dm/test-driver.c
+++ b/test/dm/test-driver.c
@@ -18,7 +18,6 @@
#include <test/ut.h>
int dm_testdrv_op_count[DM_TEST_OP_COUNT];
-static struct unit_test_state *uts = &global_dm_test_state;
static int testdrv_ping(struct udevice *dev, int pingval, int *pingret)
{
@@ -37,6 +36,8 @@ static const struct test_ops test_ops = {
static int test_bind(struct udevice *dev)
{
+ struct unit_test_state *uts = test_get_state();
+
/* Private data should not be allocated */
ut_assert(!dev_get_priv(dev));
@@ -46,6 +47,7 @@ static int test_bind(struct udevice *dev)
static int test_probe(struct udevice *dev)
{
+ struct unit_test_state *uts = test_get_state();
struct dm_test_priv *priv = dev_get_priv(dev);
/* Private data should be allocated */
@@ -58,6 +60,8 @@ static int test_probe(struct udevice *dev)
static int test_remove(struct udevice *dev)
{
+ struct unit_test_state *uts = test_get_state();
+
/* Private data should still be allocated */
ut_assert(dev_get_priv(dev));
@@ -67,6 +71,8 @@ static int test_remove(struct udevice *dev)
static int test_unbind(struct udevice *dev)
{
+ struct unit_test_state *uts = test_get_state();
+
/* Private data should not be allocated */
ut_assert(!dev_get_priv(dev));
@@ -116,6 +122,8 @@ static int test_manual_bind(struct udevice *dev)
static int test_manual_probe(struct udevice *dev)
{
+ struct unit_test_state *uts = test_get_state();
+
dm_testdrv_op_count[DM_TEST_OP_PROBE]++;
if (!uts->force_fail_alloc)
dev_set_priv(dev, calloc(1, sizeof(struct dm_test_priv)));