mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-23 17:30:02 +00:00
net: stmmac: platform: provide stmmac_pltfr_exit()
Provide a helper wrapper around calling the platform's exit() callback. This allows users to skip checking if the callback exists. Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org> Link: https://lore.kernel.org/r/20230623100417.93592-4-brgl@bgdev.pl Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
4450e7d423
commit
5b0acf8dd2
2 changed files with 18 additions and 6 deletions
|
@ -720,6 +720,20 @@ int stmmac_pltfr_init(struct platform_device *pdev,
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(stmmac_pltfr_init);
|
EXPORT_SYMBOL_GPL(stmmac_pltfr_init);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* stmmac_pltfr_exit
|
||||||
|
* @pdev: pointer to the platform device
|
||||||
|
* @plat: driver data platform structure
|
||||||
|
* Description: Call the platform's exit callback (if any).
|
||||||
|
*/
|
||||||
|
void stmmac_pltfr_exit(struct platform_device *pdev,
|
||||||
|
struct plat_stmmacenet_data *plat)
|
||||||
|
{
|
||||||
|
if (plat->exit)
|
||||||
|
plat->exit(pdev, plat->bsp_priv);
|
||||||
|
}
|
||||||
|
EXPORT_SYMBOL_GPL(stmmac_pltfr_exit);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* stmmac_pltfr_remove
|
* stmmac_pltfr_remove
|
||||||
* @pdev: platform device pointer
|
* @pdev: platform device pointer
|
||||||
|
@ -733,10 +747,7 @@ void stmmac_pltfr_remove(struct platform_device *pdev)
|
||||||
struct plat_stmmacenet_data *plat = priv->plat;
|
struct plat_stmmacenet_data *plat = priv->plat;
|
||||||
|
|
||||||
stmmac_dvr_remove(&pdev->dev);
|
stmmac_dvr_remove(&pdev->dev);
|
||||||
|
stmmac_pltfr_exit(pdev, plat);
|
||||||
if (plat->exit)
|
|
||||||
plat->exit(pdev, plat->bsp_priv);
|
|
||||||
|
|
||||||
stmmac_remove_config_dt(pdev, plat);
|
stmmac_remove_config_dt(pdev, plat);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(stmmac_pltfr_remove);
|
EXPORT_SYMBOL_GPL(stmmac_pltfr_remove);
|
||||||
|
@ -756,8 +767,7 @@ static int __maybe_unused stmmac_pltfr_suspend(struct device *dev)
|
||||||
struct platform_device *pdev = to_platform_device(dev);
|
struct platform_device *pdev = to_platform_device(dev);
|
||||||
|
|
||||||
ret = stmmac_suspend(dev);
|
ret = stmmac_suspend(dev);
|
||||||
if (priv->plat->exit)
|
stmmac_pltfr_exit(pdev, priv->plat);
|
||||||
priv->plat->exit(pdev, priv->plat->bsp_priv);
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,8 @@ int stmmac_get_platform_resources(struct platform_device *pdev,
|
||||||
|
|
||||||
int stmmac_pltfr_init(struct platform_device *pdev,
|
int stmmac_pltfr_init(struct platform_device *pdev,
|
||||||
struct plat_stmmacenet_data *plat);
|
struct plat_stmmacenet_data *plat);
|
||||||
|
void stmmac_pltfr_exit(struct platform_device *pdev,
|
||||||
|
struct plat_stmmacenet_data *plat);
|
||||||
|
|
||||||
void stmmac_pltfr_remove(struct platform_device *pdev);
|
void stmmac_pltfr_remove(struct platform_device *pdev);
|
||||||
extern const struct dev_pm_ops stmmac_pltfr_pm_ops;
|
extern const struct dev_pm_ops stmmac_pltfr_pm_ops;
|
||||||
|
|
Loading…
Reference in a new issue