Re: [PATCH v2 3/7] of: unittest: Test fw_devlink with GPIO nexus maps

From: Herve Codina

Date: Wed Sep 16 2026 - 14:03:40 EST


Hi Ernest,

On Thu, 10 Sep 2026 16:16:44 +0200
Ernest Van Hoecke <ernestvanhoecke@xxxxxxxxx> wrote:

> From: Ernest Van Hoecke <ernest.vanhoecke@xxxxxxxxxxx>
>
> Add OF unit tests that call the fw_devlink add_links operation for GPIOs
> routed through nexus maps. Verify that each mapped consumer has exactly
> one link to the final GPIO provider rather than to the nexus.
>
> Also cover direct references and all GPIO property spellings recognized
> by fw_devlink, including the deprecated singular and unprefixed forms.
>
> Signed-off-by: Ernest Van Hoecke <ernest.vanhoecke@xxxxxxxxxxx>
> ---
> drivers/of/unittest-data/tests-phandle.dtsi | 33 +++++++++++++
> drivers/of/unittest.c | 75 +++++++++++++++++++++++++++++
> 2 files changed, 108 insertions(+)
>
> diff --git a/drivers/of/unittest-data/tests-phandle.dtsi b/drivers/of/unittest-data/tests-phandle.dtsi
> index 554a996b2ef1..c3727ed15bde 100644
> --- a/drivers/of/unittest-data/tests-phandle.dtsi
> +++ b/drivers/of/unittest-data/tests-phandle.dtsi
> @@ -79,6 +79,39 @@ consumer-b {
> phandle-list-bad-args = <&provider2 1 0>,
> <&provider4 0>;
> };
> +
> + fw-devlink-tests {
> + gpio_provider: gpio-controller {
> + #gpio-cells = <2>;
> + };
> +
> + fwdevlink_nexus: nexus {
> + #gpio-cells = <2>;
> + gpio-map = <0 0 &gpio_provider 1 0>;

I would add more than one item with values other than 0 in this gpio-map to be
sure that the translation done at the Nexus node really uses the correct item.

> + gpio-map-mask = <0xffffffff 0>;
> + gpio-map-pass-thru = <0 0xffffffff>;
> + };
> +
> + gpio-compat-consumer {
> + gpios = <&fwdevlink_nexus 0 0>;

And so, I would use a value other than 0 when a consumer references the Nexus
node.

> + };
> +


Best regards,
Hervé