diff mbox series

dt-bindings: net: constrain number of 'reg' in ethernet ports

Message ID 20221028140326.43470-2-krzysztof.kozlowski@linaro.org
State New
Headers show
Series dt-bindings: net: constrain number of 'reg' in ethernet ports | expand

Commit Message

Krzysztof Kozlowski Oct. 28, 2022, 2:03 p.m. UTC
'reg' without any constraints allows multiple items which is not the
intention for Ethernet controller's port number.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

---

Please give it a time for Rob's bot to process this.
---
 Documentation/devicetree/bindings/net/asix,ax88178.yaml       | 4 +++-
 Documentation/devicetree/bindings/net/microchip,lan95xx.yaml  | 4 +++-
 .../devicetree/bindings/net/microchip,lan966x-switch.yaml     | 4 ++--
 .../devicetree/bindings/net/microchip,sparx5-switch.yaml      | 3 ++-
 .../devicetree/bindings/net/mscc,vsc7514-switch.yaml          | 3 ++-
 .../bindings/net/renesas,r8a779f0-ether-switch.yaml           | 4 ++--
 6 files changed, 14 insertions(+), 8 deletions(-)

Comments

Oleksij Rempel Oct. 30, 2022, 5:04 p.m. UTC | #1
On Fri, Oct 28, 2022 at 10:03:25AM -0400, Krzysztof Kozlowski wrote:
> 'reg' without any constraints allows multiple items which is not the
> intention for Ethernet controller's port number.
> 
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

For  asix,ax88178.yaml and microchip,lan95xx.yaml

Reviewed-by: Oleksij Rempel <o.rempel@pengutronix.de>

> 
> ---
> 
> Please give it a time for Rob's bot to process this.
> ---
>  Documentation/devicetree/bindings/net/asix,ax88178.yaml       | 4 +++-
>  Documentation/devicetree/bindings/net/microchip,lan95xx.yaml  | 4 +++-
>  .../devicetree/bindings/net/microchip,lan966x-switch.yaml     | 4 ++--
>  .../devicetree/bindings/net/microchip,sparx5-switch.yaml      | 3 ++-
>  .../devicetree/bindings/net/mscc,vsc7514-switch.yaml          | 3 ++-
>  .../bindings/net/renesas,r8a779f0-ether-switch.yaml           | 4 ++--
>  6 files changed, 14 insertions(+), 8 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/net/asix,ax88178.yaml b/Documentation/devicetree/bindings/net/asix,ax88178.yaml
> index 1af52358de4c..a81dbc4792f6 100644
> --- a/Documentation/devicetree/bindings/net/asix,ax88178.yaml
> +++ b/Documentation/devicetree/bindings/net/asix,ax88178.yaml
> @@ -27,7 +27,9 @@ properties:
>            - usbb95,772b   # ASIX AX88772B
>            - usbb95,7e2b   # ASIX AX88772B
>  
> -  reg: true
> +  reg:
> +    maxItems: 1
> +
>    local-mac-address: true
>    mac-address: true
>  
> diff --git a/Documentation/devicetree/bindings/net/microchip,lan95xx.yaml b/Documentation/devicetree/bindings/net/microchip,lan95xx.yaml
> index cf91fecd8909..3715c5f8f0e0 100644
> --- a/Documentation/devicetree/bindings/net/microchip,lan95xx.yaml
> +++ b/Documentation/devicetree/bindings/net/microchip,lan95xx.yaml
> @@ -39,7 +39,9 @@ properties:
>            - usb424,9e08   # SMSC LAN89530 USB Ethernet Device
>            - usb424,ec00   # SMSC9512/9514 USB Hub & Ethernet Device
>  
> -  reg: true
> +  reg:
> +    maxItems: 1
> +
>    local-mac-address: true
>    mac-address: true
>  
> diff --git a/Documentation/devicetree/bindings/net/microchip,lan966x-switch.yaml b/Documentation/devicetree/bindings/net/microchip,lan966x-switch.yaml
> index dc116f14750e..583d70c51be6 100644
> --- a/Documentation/devicetree/bindings/net/microchip,lan966x-switch.yaml
> +++ b/Documentation/devicetree/bindings/net/microchip,lan966x-switch.yaml
> @@ -83,8 +83,8 @@ properties:
>              const: 0
>  
>            reg:
> -            description:
> -              Switch port number
> +            items:
> +              - description: Switch port number
>  
>            phys:
>              description:
> diff --git a/Documentation/devicetree/bindings/net/microchip,sparx5-switch.yaml b/Documentation/devicetree/bindings/net/microchip,sparx5-switch.yaml
> index 57ffeb8fc876..ccb912561446 100644
> --- a/Documentation/devicetree/bindings/net/microchip,sparx5-switch.yaml
> +++ b/Documentation/devicetree/bindings/net/microchip,sparx5-switch.yaml
> @@ -89,7 +89,8 @@ properties:
>  
>          properties:
>            reg:
> -            description: Switch port number
> +            items:
> +              - description: Switch port number
>  
>            phys:
>              maxItems: 1
> diff --git a/Documentation/devicetree/bindings/net/mscc,vsc7514-switch.yaml b/Documentation/devicetree/bindings/net/mscc,vsc7514-switch.yaml
> index ee0a504bdb24..1cf82955d75e 100644
> --- a/Documentation/devicetree/bindings/net/mscc,vsc7514-switch.yaml
> +++ b/Documentation/devicetree/bindings/net/mscc,vsc7514-switch.yaml
> @@ -109,7 +109,8 @@ properties:
>  
>          properties:
>            reg:
> -            description: Switch port number
> +            items:
> +              - description: Switch port number
>  
>            phy-handle: true
>  
> diff --git a/Documentation/devicetree/bindings/net/renesas,r8a779f0-ether-switch.yaml b/Documentation/devicetree/bindings/net/renesas,r8a779f0-ether-switch.yaml
> index 581fff8902f4..0eba66a29c6c 100644
> --- a/Documentation/devicetree/bindings/net/renesas,r8a779f0-ether-switch.yaml
> +++ b/Documentation/devicetree/bindings/net/renesas,r8a779f0-ether-switch.yaml
> @@ -106,8 +106,8 @@ properties:
>  
>          properties:
>            reg:
> -            description:
> -              Port number of ETHA (TSNA).
> +            items:
> +              - description: Port number of ETHA (TSNA).
>  
>            phys:
>              maxItems: 1
> -- 
> 2.34.1
> 
>
Rob Herring Oct. 31, 2022, 6:57 p.m. UTC | #2
On Fri, Oct 28, 2022 at 10:03:25AM -0400, Krzysztof Kozlowski wrote:
> 'reg' without any constraints allows multiple items which is not the
> intention for Ethernet controller's port number.
> 

Shouldn't this constrained by dsa-port.yaml (or the under review 
ethernet switch schemas that split out the DSA parts)?

> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
> 
> ---
> 
> Please give it a time for Rob's bot to process this.
> ---
>  Documentation/devicetree/bindings/net/asix,ax88178.yaml       | 4 +++-
>  Documentation/devicetree/bindings/net/microchip,lan95xx.yaml  | 4 +++-
>  .../devicetree/bindings/net/microchip,lan966x-switch.yaml     | 4 ++--
>  .../devicetree/bindings/net/microchip,sparx5-switch.yaml      | 3 ++-
>  .../devicetree/bindings/net/mscc,vsc7514-switch.yaml          | 3 ++-
>  .../bindings/net/renesas,r8a779f0-ether-switch.yaml           | 4 ++--
>  6 files changed, 14 insertions(+), 8 deletions(-)
Krzysztof Kozlowski Nov. 2, 2022, 3:48 p.m. UTC | #3
On 31/10/2022 14:57, Rob Herring wrote:
> On Fri, Oct 28, 2022 at 10:03:25AM -0400, Krzysztof Kozlowski wrote:
>> 'reg' without any constraints allows multiple items which is not the
>> intention for Ethernet controller's port number.
>>
> 
> Shouldn't this constrained by dsa-port.yaml (or the under review 
> ethernet switch schemas that split out the DSA parts)?

dsa-port should indeed have such change (I'll send one), but these
schemas do not reference it.

They reference only ethernet-controller, which does not even mention
'reg' port. I'll describe it better in commit msg.

ethernet-switch is not yet referenced in the schemas changed here. It
would not be applicable to asix,ax88178.yaml and microchip,lan95xx.yaml.
To others - probably it would be applicable.

Best regards,
Krzysztof
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/net/asix,ax88178.yaml b/Documentation/devicetree/bindings/net/asix,ax88178.yaml
index 1af52358de4c..a81dbc4792f6 100644
--- a/Documentation/devicetree/bindings/net/asix,ax88178.yaml
+++ b/Documentation/devicetree/bindings/net/asix,ax88178.yaml
@@ -27,7 +27,9 @@  properties:
           - usbb95,772b   # ASIX AX88772B
           - usbb95,7e2b   # ASIX AX88772B
 
-  reg: true
+  reg:
+    maxItems: 1
+
   local-mac-address: true
   mac-address: true
 
diff --git a/Documentation/devicetree/bindings/net/microchip,lan95xx.yaml b/Documentation/devicetree/bindings/net/microchip,lan95xx.yaml
index cf91fecd8909..3715c5f8f0e0 100644
--- a/Documentation/devicetree/bindings/net/microchip,lan95xx.yaml
+++ b/Documentation/devicetree/bindings/net/microchip,lan95xx.yaml
@@ -39,7 +39,9 @@  properties:
           - usb424,9e08   # SMSC LAN89530 USB Ethernet Device
           - usb424,ec00   # SMSC9512/9514 USB Hub & Ethernet Device
 
-  reg: true
+  reg:
+    maxItems: 1
+
   local-mac-address: true
   mac-address: true
 
diff --git a/Documentation/devicetree/bindings/net/microchip,lan966x-switch.yaml b/Documentation/devicetree/bindings/net/microchip,lan966x-switch.yaml
index dc116f14750e..583d70c51be6 100644
--- a/Documentation/devicetree/bindings/net/microchip,lan966x-switch.yaml
+++ b/Documentation/devicetree/bindings/net/microchip,lan966x-switch.yaml
@@ -83,8 +83,8 @@  properties:
             const: 0
 
           reg:
-            description:
-              Switch port number
+            items:
+              - description: Switch port number
 
           phys:
             description:
diff --git a/Documentation/devicetree/bindings/net/microchip,sparx5-switch.yaml b/Documentation/devicetree/bindings/net/microchip,sparx5-switch.yaml
index 57ffeb8fc876..ccb912561446 100644
--- a/Documentation/devicetree/bindings/net/microchip,sparx5-switch.yaml
+++ b/Documentation/devicetree/bindings/net/microchip,sparx5-switch.yaml
@@ -89,7 +89,8 @@  properties:
 
         properties:
           reg:
-            description: Switch port number
+            items:
+              - description: Switch port number
 
           phys:
             maxItems: 1
diff --git a/Documentation/devicetree/bindings/net/mscc,vsc7514-switch.yaml b/Documentation/devicetree/bindings/net/mscc,vsc7514-switch.yaml
index ee0a504bdb24..1cf82955d75e 100644
--- a/Documentation/devicetree/bindings/net/mscc,vsc7514-switch.yaml
+++ b/Documentation/devicetree/bindings/net/mscc,vsc7514-switch.yaml
@@ -109,7 +109,8 @@  properties:
 
         properties:
           reg:
-            description: Switch port number
+            items:
+              - description: Switch port number
 
           phy-handle: true
 
diff --git a/Documentation/devicetree/bindings/net/renesas,r8a779f0-ether-switch.yaml b/Documentation/devicetree/bindings/net/renesas,r8a779f0-ether-switch.yaml
index 581fff8902f4..0eba66a29c6c 100644
--- a/Documentation/devicetree/bindings/net/renesas,r8a779f0-ether-switch.yaml
+++ b/Documentation/devicetree/bindings/net/renesas,r8a779f0-ether-switch.yaml
@@ -106,8 +106,8 @@  properties:
 
         properties:
           reg:
-            description:
-              Port number of ETHA (TSNA).
+            items:
+              - description: Port number of ETHA (TSNA).
 
           phys:
             maxItems: 1