Re: [PATCH dt-schema] schemas: i2c: Allow '-' in 'i2c-.*' node names

Rob Herring <[email protected]> Mon, 19 May 2025 20:18:53 -0500
Newsgroups org.kernel.vger.devicetree-spec,org.kernel.vger.linux-i2c
Message-ID <CAL_Jsq+UCU8RdAGVPbsFDo6aaAyoAKtjDd4yYfs47YOt__VhgQ@mail.gmail.com>
On Mon, May 19, 2025 at 1:45 PM Wolfram Sang
<[email protected]> wrote:
>
> When allowing extended i2c node names, the '-' character was not added
> to the character class. Fixes the following error:
>
> .../Kernel/linux/arch/arm/boot/dts/microchip/usb_a9g20.dtb: i2c-gpio-0 (i2c-gpio): $nodename:0: 'i2c-gpio-0' does not match '^i2c(@.+|-[a-z0-9]+)?$'
>         from schema $id: http://devicetree.org/schemas/i2c/i2c-gpio.yaml#

IMO, we should change the node name to "i2c-0". While I'm on the fence
whether it's worth changing these, I do think it is worth not getting
new ones.

> Fixes: 647181a1f8ff ("schemas: i2c: Allow for 'i2c-.*' node names")
> Signed-off-by: Wolfram Sang <[email protected]>
> ---
>
> I don't know if it is possible to define a custom character class to
> avoid similar problems in the future?
>
>  dtschema/schemas/i2c/i2c-controller.yaml | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/dtschema/schemas/i2c/i2c-controller.yaml b/dtschema/schemas/i2c/i2c-controller.yaml
> index 8488edd5ecc4..4abcf1a0ddcc 100644
> --- a/dtschema/schemas/i2c/i2c-controller.yaml
> +++ b/dtschema/schemas/i2c/i2c-controller.yaml
> @@ -14,7 +14,7 @@ maintainers:
>
>  properties:
>    $nodename:
> -    pattern: "^i2c(@.+|-[a-z0-9]+)?$"
> +    pattern: "^i2c(@.+|-[a-z0-9\\-]+)?$"
>
>    i2c-bus:
>      type: object
> --
> 2.47.2
>
>