diff mbox series

[net-next,1/3] dt-bindings: net: dsa: mt7530: replace label = "cpu" with proper checks

Message ID 20220912175058.280386-2-vladimir.oltean@nxp.com (mailing list archive)
State Mainlined
Commit 3f301a2800786dd57174a0f3f010c8449f5f6c37
Delegated to: Geert Uytterhoeven
Headers show
Series Remove label = "cpu" from DSA dt-bindings | expand

Commit Message

Vladimir Oltean Sept. 12, 2022, 5:50 p.m. UTC
The fact that some DSA device trees use 'label = "cpu"' for the CPU port
is nothing but blind cargo cult copying. The 'label' property was never
part of the DSA DT bindings for anything except the user ports, where it
provided a hint as to what name the created netdevs should use.

DSA does use the "cpu" port label to identify a CPU port in dsa_port_parse(),
but this is only for non-OF code paths (platform data).

The proper way to identify a CPU port is to look at whether the
'ethernet' phandle is present.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
---
 .../devicetree/bindings/net/dsa/mediatek,mt7530.yaml | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)

Comments

Florian Fainelli Sept. 12, 2022, 5:59 p.m. UTC | #1
On 9/12/22 10:50, Vladimir Oltean wrote:
> The fact that some DSA device trees use 'label = "cpu"' for the CPU port
> is nothing but blind cargo cult copying. The 'label' property was never
> part of the DSA DT bindings for anything except the user ports, where it
> provided a hint as to what name the created netdevs should use.
> 
> DSA does use the "cpu" port label to identify a CPU port in dsa_port_parse(),
> but this is only for non-OF code paths (platform data).
> 
> The proper way to identify a CPU port is to look at whether the
> 'ethernet' phandle is present.
> 
> Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Arınç ÜNAL Sept. 13, 2022, 8:19 a.m. UTC | #2
On 12.09.2022 20:50, Vladimir Oltean wrote:
> The fact that some DSA device trees use 'label = "cpu"' for the CPU port
> is nothing but blind cargo cult copying. The 'label' property was never
> part of the DSA DT bindings for anything except the user ports, where it
> provided a hint as to what name the created netdevs should use.
> 
> DSA does use the "cpu" port label to identify a CPU port in dsa_port_parse(),
> but this is only for non-OF code paths (platform data).
> 
> The proper way to identify a CPU port is to look at whether the
> 'ethernet' phandle is present.
> 
> Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>

Reviewed-by: Arınç ÜNAL <arinc.unal@arinc9.com>

Arınç

> ---
>   .../devicetree/bindings/net/dsa/mediatek,mt7530.yaml | 12 +++---------
>   1 file changed, 3 insertions(+), 9 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
> index f9e7b6e20b35..fa271ee16b5e 100644
> --- a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
> +++ b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
> @@ -163,9 +163,7 @@ patternProperties:
>           allOf:
>             - $ref: dsa-port.yaml#
>             - if:
> -              properties:
> -                label:
> -                  const: cpu
> +              required: [ ethernet ]
>               then:
>                 required:
>                   - phy-mode
> @@ -187,9 +185,7 @@ $defs:
>           patternProperties:
>             "^(ethernet-)?port@[0-9]+$":
>               if:
> -              properties:
> -                label:
> -                  const: cpu
> +              required: [ ethernet ]
>               then:
>                 if:
>                   properties:
> @@ -215,9 +211,7 @@ $defs:
>           patternProperties:
>             "^(ethernet-)?port@[0-9]+$":
>               if:
> -              properties:
> -                label:
> -                  const: cpu
> +              required: [ ethernet ]
>               then:
>                 if:
>                   properties:
Rob Herring Sept. 13, 2022, 3:51 p.m. UTC | #3
On Mon, 12 Sep 2022 20:50:56 +0300, Vladimir Oltean wrote:
> The fact that some DSA device trees use 'label = "cpu"' for the CPU port
> is nothing but blind cargo cult copying. The 'label' property was never
> part of the DSA DT bindings for anything except the user ports, where it
> provided a hint as to what name the created netdevs should use.
> 
> DSA does use the "cpu" port label to identify a CPU port in dsa_port_parse(),
> but this is only for non-OF code paths (platform data).
> 
> The proper way to identify a CPU port is to look at whether the
> 'ethernet' phandle is present.
> 
> Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
> ---
>  .../devicetree/bindings/net/dsa/mediatek,mt7530.yaml | 12 +++---------
>  1 file changed, 3 insertions(+), 9 deletions(-)
> 

Acked-by: Rob Herring <robh@kernel.org>
Arınç ÜNAL Sept. 13, 2022, 3:55 p.m. UTC | #4
On 12.09.2022 20:50, Vladimir Oltean wrote:
> The fact that some DSA device trees use 'label = "cpu"' for the CPU port
> is nothing but blind cargo cult copying. The 'label' property was never
> part of the DSA DT bindings for anything except the user ports, where it
> provided a hint as to what name the created netdevs should use.
> 
> DSA does use the "cpu" port label to identify a CPU port in dsa_port_parse(),
> but this is only for non-OF code paths (platform data).
> 
> The proper way to identify a CPU port is to look at whether the
> 'ethernet' phandle is present.
> 
> Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>

I realised "dt-bindings: net: dsa: mt7530:" prefix is used here instead 
of the usual "dt-bindings: net: dsa: mediatek,mt7530:". Does this matter?

Arınç
Vladimir Oltean Sept. 13, 2022, 4:26 p.m. UTC | #5
On Tue, Sep 13, 2022 at 06:55:05PM +0300, Arınç ÜNAL wrote:
> On 12.09.2022 20:50, Vladimir Oltean wrote:
> > The fact that some DSA device trees use 'label = "cpu"' for the CPU port
> > is nothing but blind cargo cult copying. The 'label' property was never
> > part of the DSA DT bindings for anything except the user ports, where it
> > provided a hint as to what name the created netdevs should use.
> > 
> > DSA does use the "cpu" port label to identify a CPU port in dsa_port_parse(),
> > but this is only for non-OF code paths (platform data).
> > 
> > The proper way to identify a CPU port is to look at whether the
> > 'ethernet' phandle is present.
> > 
> > Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
> 
> I realised "dt-bindings: net: dsa: mt7530:" prefix is used here instead of
> the usual "dt-bindings: net: dsa: mediatek,mt7530:". Does this matter?

Since "mt7530" implies "mediatek", I preferred to skip it.
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
index f9e7b6e20b35..fa271ee16b5e 100644
--- a/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
+++ b/Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml
@@ -163,9 +163,7 @@  patternProperties:
         allOf:
           - $ref: dsa-port.yaml#
           - if:
-              properties:
-                label:
-                  const: cpu
+              required: [ ethernet ]
             then:
               required:
                 - phy-mode
@@ -187,9 +185,7 @@  $defs:
         patternProperties:
           "^(ethernet-)?port@[0-9]+$":
             if:
-              properties:
-                label:
-                  const: cpu
+              required: [ ethernet ]
             then:
               if:
                 properties:
@@ -215,9 +211,7 @@  $defs:
         patternProperties:
           "^(ethernet-)?port@[0-9]+$":
             if:
-              properties:
-                label:
-                  const: cpu
+              required: [ ethernet ]
             then:
               if:
                 properties: