netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ansuel Smith <ansuelsmth@gmail.com>
To: Andrew Lunn <andrew@lunn.ch>,
	Vivien Didelot <vivien.didelot@gmail.com>,
	Florian Fainelli <f.fainelli@gmail.com>,
	Vladimir Oltean <olteanv@gmail.com>,
	"David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Ansuel Smith <ansuelsmth@gmail.com>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [net-next PATCH v3 6/6] net: dsa: qca8k: unify bus id naming with legacy and OF mdio bus
Date: Sat, 16 Apr 2022 01:30:17 +0200	[thread overview]
Message-ID: <20220415233017.23275-7-ansuelsmth@gmail.com> (raw)
In-Reply-To: <20220415233017.23275-1-ansuelsmth@gmail.com>

Add support for multiple switch with OF mdio bus declaration.
Unify the bus id naming and use the same logic for both legacy and OF
mdio bus.

Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
---
 drivers/net/dsa/qca8k.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/net/dsa/qca8k.c b/drivers/net/dsa/qca8k.c
index 4fb1486795c4..2727d3169c25 100644
--- a/drivers/net/dsa/qca8k.c
+++ b/drivers/net/dsa/qca8k.c
@@ -1323,6 +1323,8 @@ qca8k_mdio_register(struct qca8k_priv *priv)
 		return -ENOMEM;
 
 	bus->priv = (void *)priv;
+	snprintf(bus->id, MII_BUS_ID_SIZE, "qca8k-%d.%d",
+		 ds->dst->index, ds->index);
 	bus->parent = ds->dev;
 	bus->phy_mask = ~ds->phys_mii_mask;
 	ds->slave_mii_bus = bus;
@@ -1330,7 +1332,6 @@ qca8k_mdio_register(struct qca8k_priv *priv)
 	/* Check if the devicetree declare the port:phy mapping */
 	mdio = of_get_child_by_name(priv->dev->of_node, "mdio");
 	if (of_device_is_available(mdio)) {
-		snprintf(bus->id, MII_BUS_ID_SIZE, "qca8k-%d", ds->index);
 		bus->name = "qca8k slave mii";
 		bus->read = qca8k_internal_mdio_read;
 		bus->write = qca8k_internal_mdio_write;
@@ -1340,8 +1341,6 @@ qca8k_mdio_register(struct qca8k_priv *priv)
 	/* If a mapping can't be found the legacy mapping is used,
 	 * using the qca8k_port_to_phy function
 	 */
-	snprintf(bus->id, MII_BUS_ID_SIZE, "qca8k-%d.%d",
-		 ds->dst->index, ds->index);
 	bus->name = "qca8k-legacy slave mii";
 	bus->read = qca8k_legacy_mdio_read;
 	bus->write = qca8k_legacy_mdio_write;
-- 
2.34.1


  parent reply	other threads:[~2022-04-15 23:30 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-15 23:30 [net-next PATCH v3 0/6] Reduce qca8k_priv space usage Ansuel Smith
2022-04-15 23:30 ` [net-next PATCH v3 1/6] net: dsa: qca8k: drop MTU tracking from qca8k_priv Ansuel Smith
2022-04-15 23:30 ` [net-next PATCH v3 2/6] net: dsa: qca8k: drop port_sts " Ansuel Smith
2022-04-15 23:30 ` [net-next PATCH v3 3/6] net: dsa: qca8k: rework and simplify mdiobus logic Ansuel Smith
2022-04-15 23:30 ` [net-next PATCH v3 4/6] net: dsa: qca8k: drop dsa_switch_ops from qca8k_priv Ansuel Smith
2022-04-15 23:30 ` [net-next PATCH v3 5/6] net: dsa: qca8k: correctly handle mdio read error Ansuel Smith
2022-04-15 23:30 ` Ansuel Smith [this message]
2022-04-17 12:40 ` [net-next PATCH v3 0/6] Reduce qca8k_priv space usage patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220415233017.23275-7-ansuelsmth@gmail.com \
    --to=ansuelsmth@gmail.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=f.fainelli@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=olteanv@gmail.com \
    --cc=pabeni@redhat.com \
    --cc=vivien.didelot@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).