1 From 69b838d2629e6b82bcd9e0ab3c1c03f46e5e01d3 Mon Sep 17 00:00:00 2001
2 From: Daniel Golle <daniel@makrotopia.org>
3 Date: Mon, 3 Apr 2023 02:18:50 +0100
4 Subject: [PATCH 09/13] net: dsa: mt7530: introduce mt7530_remove_common helper
7 Move commonly used parts from mt7530_remove into new
8 mt7530_remove_common helper function which will be used by both,
9 mt7530_remove and the to-be-introduced mt7988_remove.
11 Signed-off-by: Daniel Golle <daniel@makrotopia.org>
12 Reviewed-by: Andrew Lunn <andrew@lunn.ch>
13 Signed-off-by: David S. Miller <davem@davemloft.net>
15 drivers/net/dsa/mt7530.c | 18 ++++++++++++------
16 1 file changed, 12 insertions(+), 6 deletions(-)
18 --- a/drivers/net/dsa/mt7530.c
19 +++ b/drivers/net/dsa/mt7530.c
20 @@ -3277,6 +3277,17 @@ mt7530_probe(struct mdio_device *mdiodev
24 +mt7530_remove_common(struct mt7530_priv *priv)
27 + mt7530_free_irq(priv);
29 + dsa_unregister_switch(priv->ds);
31 + mutex_destroy(&priv->reg_mutex);
35 mt7530_remove(struct mdio_device *mdiodev)
37 struct mt7530_priv *priv = dev_get_drvdata(&mdiodev->dev);
38 @@ -3295,15 +3306,10 @@ mt7530_remove(struct mdio_device *mdiode
39 dev_err(priv->dev, "Failed to disable io pwr: %d\n",
43 - mt7530_free_irq(priv);
45 - dsa_unregister_switch(priv->ds);
46 + mt7530_remove_common(priv);
48 for (i = 0; i < 2; ++i)
49 mtk_pcs_lynxi_destroy(priv->ports[5 + i].sgmii_pcs);
51 - mutex_destroy(&priv->reg_mutex);
54 static void mt7530_shutdown(struct mdio_device *mdiodev)