diff mbox series

[net] net: dsa: sja1105: Don't error out on disabled ports with no phy-mode

Message ID 20200116183635.4759-1-olteanv@gmail.com
State Changes Requested
Delegated to: David Miller
Headers show
Series [net] net: dsa: sja1105: Don't error out on disabled ports with no phy-mode | expand

Commit Message

Vladimir Oltean Jan. 16, 2020, 6:36 p.m. UTC
From: Vladimir Oltean <vladimir.oltean@nxp.com>

The sja1105_parse_ports_node function was tested only on device trees
where all ports were enabled. Fix this check so that the driver
continues to probe only with the ports where status is not "disabled",
as expected.

Fixes: 8aa9ebccae87 ("net: dsa: Introduce driver for NXP SJA1105 5-port L2 switch")
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
---
 drivers/net/dsa/sja1105/sja1105_main.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Florian Fainelli Jan. 16, 2020, 6:38 p.m. UTC | #1
On 1/16/20 10:36 AM, Vladimir Oltean wrote:
> From: Vladimir Oltean <vladimir.oltean@nxp.com>
> 
> The sja1105_parse_ports_node function was tested only on device trees
> where all ports were enabled. Fix this check so that the driver
> continues to probe only with the ports where status is not "disabled",
> as expected.
> 
> Fixes: 8aa9ebccae87 ("net: dsa: Introduce driver for NXP SJA1105 5-port L2 switch")
> Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
> ---
>  drivers/net/dsa/sja1105/sja1105_main.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/net/dsa/sja1105/sja1105_main.c b/drivers/net/dsa/sja1105/sja1105_main.c
> index 784e6b8166a0..b27ef01b9445 100644
> --- a/drivers/net/dsa/sja1105/sja1105_main.c
> +++ b/drivers/net/dsa/sja1105/sja1105_main.c
> @@ -580,6 +580,9 @@ static int sja1105_parse_ports_node(struct sja1105_private *priv,
>  		u32 index;
>  		int err;
>  
> +		if (!of_device_is_available(child))
> +			continue;

This works, or you can use for_each_available_child_of_node()?

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Vladimir Oltean Jan. 16, 2020, 6:46 p.m. UTC | #2
On Thu, 16 Jan 2020 at 20:38, Florian Fainelli <f.fainelli@gmail.com> wrote:
>
> On 1/16/20 10:36 AM, Vladimir Oltean wrote:
> > From: Vladimir Oltean <vladimir.oltean@nxp.com>
> >
> > The sja1105_parse_ports_node function was tested only on device trees
> > where all ports were enabled. Fix this check so that the driver
> > continues to probe only with the ports where status is not "disabled",
> > as expected.
> >
> > Fixes: 8aa9ebccae87 ("net: dsa: Introduce driver for NXP SJA1105 5-port L2 switch")
> > Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
> > ---
> >  drivers/net/dsa/sja1105/sja1105_main.c | 3 +++
> >  1 file changed, 3 insertions(+)
> >
> > diff --git a/drivers/net/dsa/sja1105/sja1105_main.c b/drivers/net/dsa/sja1105/sja1105_main.c
> > index 784e6b8166a0..b27ef01b9445 100644
> > --- a/drivers/net/dsa/sja1105/sja1105_main.c
> > +++ b/drivers/net/dsa/sja1105/sja1105_main.c
> > @@ -580,6 +580,9 @@ static int sja1105_parse_ports_node(struct sja1105_private *priv,
> >               u32 index;
> >               int err;
> >
> > +             if (!of_device_is_available(child))
> > +                     continue;
>
> This works, or you can use for_each_available_child_of_node()?
>
> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
> --
> Florian

Thanks Florian. I've sent out a v2. I would have linked to v2 in
patchwork here but it looks like it's down.

-Vladimir
diff mbox series

Patch

diff --git a/drivers/net/dsa/sja1105/sja1105_main.c b/drivers/net/dsa/sja1105/sja1105_main.c
index 784e6b8166a0..b27ef01b9445 100644
--- a/drivers/net/dsa/sja1105/sja1105_main.c
+++ b/drivers/net/dsa/sja1105/sja1105_main.c
@@ -580,6 +580,9 @@  static int sja1105_parse_ports_node(struct sja1105_private *priv,
 		u32 index;
 		int err;
 
+		if (!of_device_is_available(child))
+			continue;
+
 		/* Get switch port number from DT */
 		if (of_property_read_u32(child, "reg", &index) < 0) {
 			dev_err(dev, "Port number not defined in device tree "