Hi Markus, On Thu, 8 Jan 2026 at 04:17, Markus Schneider-Pargmann (TI.com) <[email protected]> wrote: > > Add a test for binding of multiple drivers with the same compatible. If > one of the drivers returns -ENODEV the other one needs to be bound. > > Signed-off-by: Markus Schneider-Pargmann (TI.com) <[email protected]> > --- > arch/sandbox/dts/test.dts | 4 ++++ > test/dm/core.c | 15 +++++++++++++++ > test/dm/test-driver.c | 25 +++++++++++++++++++++++++ > 3 files changed, 44 insertions(+) >
Reviewed-by: Simon Glass <[email protected]> nit below > diff --git a/arch/sandbox/dts/test.dts b/arch/sandbox/dts/test.dts > index > a2c739a2044c728a96b5f4acbf439a42d7e12fb5..9cc854ffe80e994e34010e299029a7f1756697e0 > 100644 > --- a/arch/sandbox/dts/test.dts > +++ b/arch/sandbox/dts/test.dts > @@ -457,6 +457,10 @@ > mux-control-names = "mux0"; > }; > > + multimatch-test { > + compatible = "sandbox,multimatch-test"; > + }; > + > phy_provider0: gen_phy@0 { > compatible = "sandbox,phy"; > #phy-cells = <1>; > diff --git a/test/dm/core.c b/test/dm/core.c > index > 53693f4f7ed7c7265218e4154ebf81a044a3a431..78ee14af228ab20a6639bb076260296adaea2c92 > 100644 > --- a/test/dm/core.c > +++ b/test/dm/core.c > @@ -1410,3 +1410,18 @@ static int dm_test_try_first_device(struct > unit_test_state *uts) > return 0; > } > DM_TEST(dm_test_try_first_device, 0); > + > +/* Test that all drivers are iterated when bind returns -ENODEV */ > +static int dm_test_multimatch(struct unit_test_state *uts) > +{ > + struct udevice *dev; > + > + ut_assertok(uclass_find_device_by_name(UCLASS_TEST, "multimatch-test", > + &dev)); > + ut_assertnonnull(dev); > + ut_asserteq_str("test_multimatch_second", dev->driver->name); > + ut_asserteq(2, dm_testdrv_op_count[DM_TEST_OP_BIND]); > + > + return 0; > +} > +DM_TEST(dm_test_multimatch, UTF_SCAN_FDT); > diff --git a/test/dm/test-driver.c b/test/dm/test-driver.c > index > 759de3a5f77f4b64ea577a293586a737e4623f60..bf953d7814df6a0e6efd6c2a3960a925a3fbe5a7 > 100644 > --- a/test/dm/test-driver.c > +++ b/test/dm/test-driver.c > @@ -197,3 +197,28 @@ U_BOOT_DRIVER(test_act_dma_vital_clk_drv) = { > .unbind = test_manual_unbind, > .flags = DM_FLAG_VITAL | DM_FLAG_ACTIVE_DMA, > }; > + > +static int test_multimatch_first_bind(struct udevice *dev) > +{ > + dm_testdrv_op_count[DM_TEST_OP_BIND]++; <blank line here> > + return -ENODEV; > +} > + > +static const struct udevice_id test_multimatch_ids[] = { > + { .compatible = "sandbox,multimatch-test" }, > + { } > +}; > + > +U_BOOT_DRIVER(test_multimatch_first) = { > + .name = "test_multimatch_first", > + .id = UCLASS_TEST, > + .of_match = test_multimatch_ids, > + .bind = test_multimatch_first_bind, > +}; > + > +U_BOOT_DRIVER(test_multimatch_second) = { > + .name = "test_multimatch_second", > + .id = UCLASS_TEST, > + .of_match = test_multimatch_ids, > + .bind = test_manual_bind, > +}; > > -- > 2.51.0 > Regards, Simon

