1 From 720d736351761574af02ed093658ab60de60576c 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 12/16] 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 @@ -3323,6 +3323,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 @@ -3341,16 +3352,11 @@ 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);
53 dev_set_drvdata(&mdiodev->dev, NULL);