Skip to content

Commit 1be0c9d

Browse files
Bartosz Golaszewskikuba-moo
authored andcommitted
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>
1 parent 0a68a59 commit 1be0c9d

2 files changed

Lines changed: 19 additions & 2 deletions

File tree

drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -762,6 +762,23 @@ int stmmac_pltfr_probe(struct platform_device *pdev,
762762
}
763763
EXPORT_SYMBOL_GPL(stmmac_pltfr_probe);
764764

765+
/**
766+
* stmmac_pltfr_remove_no_dt
767+
* @pdev: pointer to the platform device
768+
* Description: This undoes the effects of stmmac_pltfr_probe() by removing the
769+
* driver and calling the platform's exit() callback.
770+
*/
771+
void stmmac_pltfr_remove_no_dt(struct platform_device *pdev)
772+
{
773+
struct net_device *ndev = platform_get_drvdata(pdev);
774+
struct stmmac_priv *priv = netdev_priv(ndev);
775+
struct plat_stmmacenet_data *plat = priv->plat;
776+
777+
stmmac_dvr_remove(&pdev->dev);
778+
stmmac_pltfr_exit(pdev, plat);
779+
}
780+
EXPORT_SYMBOL_GPL(stmmac_pltfr_remove_no_dt);
781+
765782
/**
766783
* stmmac_pltfr_remove
767784
* @pdev: platform device pointer
@@ -774,8 +791,7 @@ void stmmac_pltfr_remove(struct platform_device *pdev)
774791
struct stmmac_priv *priv = netdev_priv(ndev);
775792
struct plat_stmmacenet_data *plat = priv->plat;
776793

777-
stmmac_dvr_remove(&pdev->dev);
778-
stmmac_pltfr_exit(pdev, plat);
794+
stmmac_pltfr_remove_no_dt(pdev);
779795
stmmac_remove_config_dt(pdev, plat);
780796
}
781797
EXPORT_SYMBOL_GPL(stmmac_pltfr_remove);

drivers/net/ethernet/stmicro/stmmac/stmmac_platform.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ void stmmac_pltfr_exit(struct platform_device *pdev,
2727
int stmmac_pltfr_probe(struct platform_device *pdev,
2828
struct plat_stmmacenet_data *plat,
2929
struct stmmac_resources *res);
30+
void stmmac_pltfr_remove_no_dt(struct platform_device *pdev);
3031
void stmmac_pltfr_remove(struct platform_device *pdev);
3132
extern const struct dev_pm_ops stmmac_pltfr_pm_ops;
3233

0 commit comments

Comments
 (0)