summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2015-01-25 08:27:04 -0700
committerSimon Glass <sjg@chromium.org>2015-01-29 17:09:55 -0700
commitb367053102e597eb21b0a5e86c63e8d10f368cb0 (patch)
tree352917bf63f69dec8584a547c836548f87a07cde /test
parent0118ce79577f9b0881f99a6e4f8a79cd5014cb87 (diff)
dm: core: Add a function to get a device's uclass ID
This is useful to check which uclass a device is in. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Diffstat (limited to 'test')
-rw-r--r--test/dm/core.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/dm/core.c b/test/dm/core.c
index ff5c2a749c5..eccda0974da 100644
--- a/test/dm/core.c
+++ b/test/dm/core.c
@@ -598,3 +598,14 @@ static int dm_test_uclass_before_ready(struct dm_test_state *dms)
}
DM_TEST(dm_test_uclass_before_ready, 0);
+
+static int dm_test_device_get_uclass_id(struct dm_test_state *dms)
+{
+ struct udevice *dev;
+
+ ut_assertok(uclass_get_device(UCLASS_TEST, 0, &dev));
+ ut_asserteq(UCLASS_TEST, device_get_uclass_id(dev));
+
+ return 0;
+}
+DM_TEST(dm_test_device_get_uclass_id, DM_TESTF_SCAN_PDATA);