public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH RFC net-next 08/23] net: dsa: lantiq_gswip: store switch API version in priv
@ 2025-08-16 19:52 Daniel Golle
  2025-08-17 15:30 ` Andrew Lunn
  0 siblings, 1 reply; 2+ messages in thread
From: Daniel Golle @ 2025-08-16 19:52 UTC (permalink / raw)
  To: Andrew Lunn, Vladimir Oltean, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Hauke Mehrtens, Simon Horman,
	Russell King, Florian Fainelli, Arkadi Sharshevsky, linux-kernel,
	netdev
  Cc: Andreas Schirm, Lukas Stockmann, Alexander Sverdlin,
	Peter Christen, Avinash Jayaraman, Bing tao Xu, Liang Xu,
	Juraj Povazanec, Fanni (Fang-Yi) Chan, Benny (Ying-Tsan) Weng,
	Livia M. Rosu, John Crispin

Store the switch API version in struct gswip_priv to prepare supporting
newer features such as 4096 VLANs and per-port configurable learning.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
---
 drivers/net/dsa/lantiq_gswip.c | 13 ++++++-------
 drivers/net/dsa/lantiq_gswip.h |  1 +
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/net/dsa/lantiq_gswip.c b/drivers/net/dsa/lantiq_gswip.c
index a66466bac1a8..16b92af9ff23 100644
--- a/drivers/net/dsa/lantiq_gswip.c
+++ b/drivers/net/dsa/lantiq_gswip.c
@@ -1882,7 +1882,6 @@ static int gswip_probe(struct platform_device *pdev)
 	struct gswip_priv *priv;
 	int err;
 	int i;
-	u32 version;
 
 	priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
 	if (!priv)
@@ -1915,10 +1914,10 @@ static int gswip_probe(struct platform_device *pdev)
 	priv->ds->phylink_mac_ops = &gswip_phylink_mac_ops;
 	priv->dev = dev;
 	mutex_init(&priv->pce_table_lock);
-	version = gswip_switch_r(priv, GSWIP_VERSION);
+	priv->version = gswip_switch_r(priv, GSWIP_VERSION);
 
 	np = dev->of_node;
-	switch (version) {
+	switch (priv->version) {
 	case GSWIP_VERSION_2_0:
 	case GSWIP_VERSION_2_1:
 		if (!of_device_is_compatible(np, "lantiq,xrx200-gswip"))
@@ -1932,13 +1931,13 @@ static int gswip_probe(struct platform_device *pdev)
 		break;
 	default:
 		return dev_err_probe(dev, -ENOENT,
-				     "unknown GSWIP version: 0x%x\n", version);
+				     "unknown GSWIP version: 0x%x\n", priv->version);
 	}
 
 	/* bring up the mdio bus */
 	gphy_fw_np = of_get_compatible_child(dev->of_node, "lantiq,gphy-fw");
 	if (gphy_fw_np) {
-		err = gswip_gphy_fw_list(priv, gphy_fw_np, version);
+		err = gswip_gphy_fw_list(priv, gphy_fw_np, priv->version);
 		of_node_put(gphy_fw_np);
 		if (err)
 			return dev_err_probe(dev, err,
@@ -1965,8 +1964,8 @@ static int gswip_probe(struct platform_device *pdev)
 	platform_set_drvdata(pdev, priv);
 
 	dev_info(dev, "probed GSWIP version %lx mod %lx\n",
-		 (version & GSWIP_VERSION_REV_MASK) >> GSWIP_VERSION_REV_SHIFT,
-		 (version & GSWIP_VERSION_MOD_MASK) >> GSWIP_VERSION_MOD_SHIFT);
+		 (priv->version & GSWIP_VERSION_REV_MASK) >> GSWIP_VERSION_REV_SHIFT,
+		 (priv->version & GSWIP_VERSION_MOD_MASK) >> GSWIP_VERSION_MOD_SHIFT);
 	return 0;
 
 disable_switch:
diff --git a/drivers/net/dsa/lantiq_gswip.h b/drivers/net/dsa/lantiq_gswip.h
index c68848fb1c2d..433b65b047dd 100644
--- a/drivers/net/dsa/lantiq_gswip.h
+++ b/drivers/net/dsa/lantiq_gswip.h
@@ -260,6 +260,7 @@ struct gswip_priv {
 	int num_gphy_fw;
 	struct gswip_gphy_fw *gphy_fw;
 	u32 port_vlan_filter;
+	u32 version;
 	struct mutex pce_table_lock;
 };
 
-- 
2.50.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH RFC net-next 08/23] net: dsa: lantiq_gswip: store switch API version in priv
  2025-08-16 19:52 [PATCH RFC net-next 08/23] net: dsa: lantiq_gswip: store switch API version in priv Daniel Golle
@ 2025-08-17 15:30 ` Andrew Lunn
  0 siblings, 0 replies; 2+ messages in thread
From: Andrew Lunn @ 2025-08-17 15:30 UTC (permalink / raw)
  To: Daniel Golle
  Cc: Vladimir Oltean, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Hauke Mehrtens, Simon Horman, Russell King,
	Florian Fainelli, Arkadi Sharshevsky, linux-kernel, netdev,
	Andreas Schirm, Lukas Stockmann, Alexander Sverdlin,
	Peter Christen, Avinash Jayaraman, Bing tao Xu, Liang Xu,
	Juraj Povazanec, Fanni (Fang-Yi) Chan, Benny (Ying-Tsan) Weng,
	Livia M. Rosu, John Crispin

On Sat, Aug 16, 2025 at 08:52:30PM +0100, Daniel Golle wrote:
> Store the switch API version in struct gswip_priv to prepare supporting
> newer features such as 4096 VLANs and per-port configurable learning.
> 
> Signed-off-by: Daniel Golle <daniel@makrotopia.org>

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-08-17 15:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-16 19:52 [PATCH RFC net-next 08/23] net: dsa: lantiq_gswip: store switch API version in priv Daniel Golle
2025-08-17 15:30 ` Andrew Lunn

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox