net: stmmac: platform: provide stmmac_pltfr_remove_no_dt()

Add a variant of stmmac_pltfr_remove() that only frees resources
allocated by stmmac_pltfr_probe() and - unlike stmmac_pltfr_remove() -
does not call stmmac_remove_config_dt().

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Link: https://lore.kernel.org/r/20230623100417.93592-8-brgl@bgdev.pl
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
Bartosz Golaszewski 2023-06-23 12:04:13 +02:00 committed by Jakub Kicinski
parent 0a68a59493
commit 1be0c9d65e
2 changed files with 19 additions and 2 deletions

View File

@ -762,6 +762,23 @@ int stmmac_pltfr_probe(struct platform_device *pdev,
}
EXPORT_SYMBOL_GPL(stmmac_pltfr_probe);
/**
* stmmac_pltfr_remove_no_dt
* @pdev: pointer to the platform device
* Description: This undoes the effects of stmmac_pltfr_probe() by removing the
* driver and calling the platform's exit() callback.
*/
void stmmac_pltfr_remove_no_dt(struct platform_device *pdev)
{
struct net_device *ndev = platform_get_drvdata(pdev);
struct stmmac_priv *priv = netdev_priv(ndev);
struct plat_stmmacenet_data *plat = priv->plat;
stmmac_dvr_remove(&pdev->dev);
stmmac_pltfr_exit(pdev, plat);
}
EXPORT_SYMBOL_GPL(stmmac_pltfr_remove_no_dt);
/**
* stmmac_pltfr_remove
* @pdev: platform device pointer
@ -774,8 +791,7 @@ void stmmac_pltfr_remove(struct platform_device *pdev)
struct stmmac_priv *priv = netdev_priv(ndev);
struct plat_stmmacenet_data *plat = priv->plat;
stmmac_dvr_remove(&pdev->dev);
stmmac_pltfr_exit(pdev, plat);
stmmac_pltfr_remove_no_dt(pdev);
stmmac_remove_config_dt(pdev, plat);
}
EXPORT_SYMBOL_GPL(stmmac_pltfr_remove);

View File

@ -27,6 +27,7 @@ void stmmac_pltfr_exit(struct platform_device *pdev,
int stmmac_pltfr_probe(struct platform_device *pdev,
struct plat_stmmacenet_data *plat,
struct stmmac_resources *res);
void stmmac_pltfr_remove_no_dt(struct platform_device *pdev);
void stmmac_pltfr_remove(struct platform_device *pdev);
extern const struct dev_pm_ops stmmac_pltfr_pm_ops;