diff options
author | Vladimir Oltean <vladimir.oltean@nxp.com> | 2024-01-04 17:00:32 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2024-01-05 14:56:35 +0300 |
commit | e66bf63a7f670a600338faf889bed71f90c183bf (patch) | |
tree | d7e52d8072ce08cd5d09dcdfae7c717b904dc38f /drivers/net/dsa | |
parent | 68e1010cda7967cfca9c8650ee1f4efcae54ab90 (diff) | |
download | linux-e66bf63a7f670a600338faf889bed71f90c183bf.tar.xz |
net: dsa: qca8k: skip MDIO bus creation if its OF node has status = "disabled"
Currently the driver calls the non-OF devm_mdiobus_register() rather
than devm_of_mdiobus_register() for this case, but it seems to rather
be a confusing coincidence, and not a real use case that needs to be
supported.
If the device tree says status = "disabled" for the MDIO bus, we
shouldn't need an MDIO bus at all. Instead, just exit as early as
possible and do not call any MDIO API.
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Alvin Šipraga <alsi@bang-olufsen.dk>
Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/dsa')
-rw-r--r-- | drivers/net/dsa/qca/qca8k-8xxx.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/net/dsa/qca/qca8k-8xxx.c b/drivers/net/dsa/qca/qca8k-8xxx.c index 5f47a290bd6e..21e36bc3c015 100644 --- a/drivers/net/dsa/qca/qca8k-8xxx.c +++ b/drivers/net/dsa/qca/qca8k-8xxx.c @@ -949,9 +949,11 @@ qca8k_mdio_register(struct qca8k_priv *priv) struct dsa_switch *ds = priv->ds; struct device_node *mdio; struct mii_bus *bus; - int err; + int err = 0; mdio = of_get_child_by_name(priv->dev->of_node, "mdio"); + if (mdio && !of_device_is_available(mdio)) + goto out; bus = devm_mdiobus_alloc(ds->dev); if (!bus) { @@ -967,7 +969,7 @@ qca8k_mdio_register(struct qca8k_priv *priv) ds->user_mii_bus = bus; /* Check if the devicetree declare the port:phy mapping */ - if (of_device_is_available(mdio)) { + if (mdio) { bus->name = "qca8k user mii"; bus->read = qca8k_internal_mdio_read; bus->write = qca8k_internal_mdio_write; @@ -986,7 +988,7 @@ qca8k_mdio_register(struct qca8k_priv *priv) out_put_node: of_node_put(mdio); - +out: return err; } |