public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: "Markus Schneider-Pargmann" <msp@baylibre.com>
To: "Simon Glass" <sjg@chromium.org>,
	"Markus Schneider-Pargmann (TI.com)" <msp@baylibre.com>
Cc: <u-boot@lists.denx.de>,
	"Mattijs Korpershoek" <mkorpershoek@kernel.org>,
	"Tom Rini" <trini@konsulko.com>, "Marek Vasut" <marex@denx.de>,
	"Andrew Goodbody" <andrew.goodbody@linaro.org>,
	"Kory Maincent" <kory.maincent@bootlin.com>,
	"Svyatoslav Ryhel" <clamor95@gmail.com>,
	"Christian Marangi" <ansuelsmth@gmail.com>,
	"Dinesh Maniyam" <dinesh.maniyam@altera.com>,
	"Heiko Schocher" <hs@nabladev.com>
Subject: Re: [PATCH v2 4/6] test: dm: Add compatible multimatch test
Date: Mon, 12 Jan 2026 10:48:11 +0100	[thread overview]
Message-ID: <DFMIL9EHIYOP.V8NWH55NYJTA@baylibre.com> (raw)
In-Reply-To: <CAFLszTjav_oJwQom-J7m_hoJ4HU-U0DDodpSF08R+Fwfi9Bchg@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 3524 bytes --]

On Fri Jan 9, 2026 at 12:32 PM CET, Simon Glass wrote:
> Hi Markus,
>
> On Thu, 8 Jan 2026 at 04:17, Markus Schneider-Pargmann (TI.com)
> <msp@baylibre.com> 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) <msp@baylibre.com>
>> ---
>>  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 <simon.glass@canonical.com>
>
> nit below

Done, and thanks for your reviews!

Best
Markus

>
>> 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


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 289 bytes --]

  reply	other threads:[~2026-01-12 13:12 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-08 11:16 [PATCH v2 0/6] dm: core: Support same compatible in host/gadget musb drivers Markus Schneider-Pargmann (TI.com)
2026-01-08 11:16 ` [PATCH v2 1/6] dm: core: lists_bind_fdt: Remove unused variable Markus Schneider-Pargmann (TI.com)
2026-01-09 11:32   ` Simon Glass
2026-01-08 11:16 ` [PATCH v2 2/6] dm: core: lists_bind_fdt: Replace found variable Markus Schneider-Pargmann (TI.com)
2026-01-09 11:32   ` Simon Glass
2026-01-12  9:31     ` Markus Schneider-Pargmann
2026-01-08 11:16 ` [PATCH v2 3/6] dm: core: Support multiple drivers with same compatibles Markus Schneider-Pargmann (TI.com)
2026-01-09 11:36   ` Simon Glass
2026-01-12  9:41     ` Markus Schneider-Pargmann
2026-01-08 11:16 ` [PATCH v2 4/6] test: dm: Add compatible multimatch test Markus Schneider-Pargmann (TI.com)
2026-01-09 11:32   ` Simon Glass
2026-01-12  9:48     ` Markus Schneider-Pargmann [this message]
2026-01-08 11:16 ` [PATCH v2 5/6] usb: musb-new: Relative ctrl_mod address parsing Markus Schneider-Pargmann (TI.com)
2026-01-08 11:16 ` [PATCH v2 6/6] usb: musb-new: Add compatibles for ti,musb-am33xx Markus Schneider-Pargmann (TI.com)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=DFMIL9EHIYOP.V8NWH55NYJTA@baylibre.com \
    --to=msp@baylibre.com \
    --cc=andrew.goodbody@linaro.org \
    --cc=ansuelsmth@gmail.com \
    --cc=clamor95@gmail.com \
    --cc=dinesh.maniyam@altera.com \
    --cc=hs@nabladev.com \
    --cc=kory.maincent@bootlin.com \
    --cc=marex@denx.de \
    --cc=mkorpershoek@kernel.org \
    --cc=sjg@chromium.org \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox