Commit fc9ee2ac authored by Bartosz Golaszewski's avatar Bartosz Golaszewski Committed by Jakub Kicinski

net: stmmac: platform: provide devm_stmmac_pltfr_probe()

Provide a devres variant of stmmac_pltfr_probe() which allows users to
skip calling stmmac_pltfr_remove() at driver detach.
Signed-off-by: default avatarBartosz Golaszewski <bartosz.golaszewski@linaro.org>
Link: https://lore.kernel.org/r/20230623100417.93592-11-brgl@bgdev.plSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 061425d9
......@@ -803,6 +803,36 @@ int stmmac_pltfr_probe(struct platform_device *pdev,
}
EXPORT_SYMBOL_GPL(stmmac_pltfr_probe);
static void devm_stmmac_pltfr_remove(void *data)
{
struct platform_device *pdev = data;
stmmac_pltfr_remove_no_dt(pdev);
}
/**
* devm_stmmac_pltfr_probe
* @pdev: pointer to the platform device
* @plat: driver data platform structure
* @res: stmmac resources
* Description: Devres variant of stmmac_pltfr_probe(). Allows users to skip
* calling stmmac_pltfr_remove() on driver detach.
*/
int devm_stmmac_pltfr_probe(struct platform_device *pdev,
struct plat_stmmacenet_data *plat,
struct stmmac_resources *res)
{
int ret;
ret = stmmac_pltfr_probe(pdev, plat, res);
if (ret)
return ret;
return devm_add_action_or_reset(&pdev->dev, devm_stmmac_pltfr_remove,
pdev);
}
EXPORT_SYMBOL_GPL(devm_stmmac_pltfr_probe);
/**
* stmmac_pltfr_remove_no_dt
* @pdev: pointer to the platform device
......
......@@ -29,6 +29,9 @@ 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);
int devm_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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment