devicetree-spec.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH dt-schema] schemas: i2c: Allow '-' in 'i2c-.*' node names
@ 2025-05-19 18:43 Wolfram Sang
  2025-05-20  1:18 ` Rob Herring
  0 siblings, 1 reply; 5+ messages in thread
From: Wolfram Sang @ 2025-05-19 18:43 UTC (permalink / raw)
  To: devicetree-spec; +Cc: linux-i2c, Wolfram Sang

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#

Fixes: 647181a1f8ff ("schemas: i2c: Allow for 'i2c-.*' node names")
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---

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


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH dt-schema] schemas: i2c: Allow '-' in 'i2c-.*' node names
  2025-05-19 18:43 [PATCH dt-schema] schemas: i2c: Allow '-' in 'i2c-.*' node names Wolfram Sang
@ 2025-05-20  1:18 ` Rob Herring
  2025-05-20  9:25   ` Wolfram Sang
  0 siblings, 1 reply; 5+ messages in thread
From: Rob Herring @ 2025-05-20  1:18 UTC (permalink / raw)
  To: Wolfram Sang; +Cc: devicetree-spec, linux-i2c

On Mon, May 19, 2025 at 1:45 PM Wolfram Sang
<wsa+renesas@sang-engineering.com> 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 <wsa+renesas@sang-engineering.com>
> ---
>
> 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
>
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH dt-schema] schemas: i2c: Allow '-' in 'i2c-.*' node names
  2025-05-20  1:18 ` Rob Herring
@ 2025-05-20  9:25   ` Wolfram Sang
  2025-05-20 12:29     ` Rob Herring
  0 siblings, 1 reply; 5+ messages in thread
From: Wolfram Sang @ 2025-05-20  9:25 UTC (permalink / raw)
  To: Rob Herring; +Cc: devicetree-spec, linux-i2c

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

On Mon, May 19, 2025 at 08:18:53PM -0500, Rob Herring wrote:
> On Mon, May 19, 2025 at 1:45 PM Wolfram Sang
> <wsa+renesas@sang-engineering.com> 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.

It is hard changing the existing ones. They are numbered based on the
numbers of GPIO based I2C busses only. If we drop "gpio-", they need to
be mixed with other non-GPIO busses. That numbering is usually unique
per board and can't be automated.


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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH dt-schema] schemas: i2c: Allow '-' in 'i2c-.*' node names
  2025-05-20  9:25   ` Wolfram Sang
@ 2025-05-20 12:29     ` Rob Herring
  2025-05-21  9:35       ` Wolfram Sang
  0 siblings, 1 reply; 5+ messages in thread
From: Rob Herring @ 2025-05-20 12:29 UTC (permalink / raw)
  To: Wolfram Sang, Rob Herring, devicetree-spec, linux-i2c

On Tue, May 20, 2025 at 4:25 AM Wolfram Sang
<wsa+renesas@sang-engineering.com> wrote:
>
> On Mon, May 19, 2025 at 08:18:53PM -0500, Rob Herring wrote:
> > On Mon, May 19, 2025 at 1:45 PM Wolfram Sang
> > <wsa+renesas@sang-engineering.com> 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.
>
> It is hard changing the existing ones. They are numbered based on the
> numbers of GPIO based I2C busses only. If we drop "gpio-", they need to
> be mixed with other non-GPIO busses. That numbering is usually unique
> per board and can't be automated.

I don't understand. For arm32, I see 1 case of possibly already having
an i2c-[0-9] name and that's in
arch/arm/boot/dts/samsung/exynos5250-arndale.dts. The non-GPIO I2C
buses are all MMIO and have unit addresses (and also aren't at the
root level).

The hardest part is doing a dtb->dts pass and comparing those before
and after to make sure you haven't combined or split nodes.

Rob

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH dt-schema] schemas: i2c: Allow '-' in 'i2c-.*' node names
  2025-05-20 12:29     ` Rob Herring
@ 2025-05-21  9:35       ` Wolfram Sang
  0 siblings, 0 replies; 5+ messages in thread
From: Wolfram Sang @ 2025-05-21  9:35 UTC (permalink / raw)
  To: Rob Herring; +Cc: devicetree-spec, linux-i2c

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


> The hardest part is doing a dtb->dts pass and comparing those before
> and after to make sure you haven't combined or split nodes.

I'll pass. I'll fix the boards I have actually access to, but the above
task sounds no fun to me.

That being said: is my original patch here rejected? We allow only one
'-' for i2c node names?


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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-05-21  9:35 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-19 18:43 [PATCH dt-schema] schemas: i2c: Allow '-' in 'i2c-.*' node names Wolfram Sang
2025-05-20  1:18 ` Rob Herring
2025-05-20  9:25   ` Wolfram Sang
2025-05-20 12:29     ` Rob Herring
2025-05-21  9:35       ` Wolfram Sang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).