mirror of
https://github.com/u-boot/u-boot.git
synced 2025-05-08 19:11:53 +00:00
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>
This commit is contained in:
parent
0118ce7957
commit
b367053102
3 changed files with 24 additions and 0 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue