Commit a4506722 authored by Radu Pirea (OSS)'s avatar Radu Pirea (OSS) Committed by Paolo Abeni
Browse files

net: phy: nxp-c45-tja11xx: add remove callback



Unregister PTP clock when the driver is removed.
Purge the RX and TX skb queues.

Fixes: 514def5d ("phy: nxp-c45-tja11xx: add timestamping support")
CC: stable@vger.kernel.org # 5.15+
Signed-off-by: default avatarRadu Pirea (OSS) <radu-nicolae.pirea@oss.nxp.com>
Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
Link: https://lore.kernel.org/r/20230406095904.75456-1-radu-nicolae.pirea@oss.nxp.com


Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
parent 9a06fe08
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -1337,6 +1337,17 @@ static int nxp_c45_probe(struct phy_device *phydev)
	return ret;
}

static void nxp_c45_remove(struct phy_device *phydev)
{
	struct nxp_c45_phy *priv = phydev->priv;

	if (priv->ptp_clock)
		ptp_clock_unregister(priv->ptp_clock);

	skb_queue_purge(&priv->tx_queue);
	skb_queue_purge(&priv->rx_queue);
}

static struct phy_driver nxp_c45_driver[] = {
	{
		PHY_ID_MATCH_MODEL(PHY_ID_TJA_1103),
@@ -1359,6 +1370,7 @@ static struct phy_driver nxp_c45_driver[] = {
		.set_loopback		= genphy_c45_loopback,
		.get_sqi		= nxp_c45_get_sqi,
		.get_sqi_max		= nxp_c45_get_sqi_max,
		.remove			= nxp_c45_remove,
	},
};