Commit 115c9248 authored by Jisheng Zhang's avatar Jisheng Zhang Committed by David S. Miller

net: stmmac: dwmac-imx: use devm_stmmac_probe_config_dt()

Simplify the driver's probe() function by using the devres
variant of stmmac_probe_config_dt().

The remove_new() callback now needs to be switched to
stmmac_pltfr_remove_no_dt().
Signed-off-by: default avatarJisheng Zhang <jszhang@kernel.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 14ec0fc5
...@@ -331,15 +331,14 @@ static int imx_dwmac_probe(struct platform_device *pdev) ...@@ -331,15 +331,14 @@ static int imx_dwmac_probe(struct platform_device *pdev)
if (!dwmac) if (!dwmac)
return -ENOMEM; return -ENOMEM;
plat_dat = stmmac_probe_config_dt(pdev, stmmac_res.mac); plat_dat = devm_stmmac_probe_config_dt(pdev, stmmac_res.mac);
if (IS_ERR(plat_dat)) if (IS_ERR(plat_dat))
return PTR_ERR(plat_dat); return PTR_ERR(plat_dat);
data = of_device_get_match_data(&pdev->dev); data = of_device_get_match_data(&pdev->dev);
if (!data) { if (!data) {
dev_err(&pdev->dev, "failed to get match data\n"); dev_err(&pdev->dev, "failed to get match data\n");
ret = -EINVAL; return -EINVAL;
goto err_match_data;
} }
dwmac->ops = data; dwmac->ops = data;
...@@ -348,7 +347,7 @@ static int imx_dwmac_probe(struct platform_device *pdev) ...@@ -348,7 +347,7 @@ static int imx_dwmac_probe(struct platform_device *pdev)
ret = imx_dwmac_parse_dt(dwmac, &pdev->dev); ret = imx_dwmac_parse_dt(dwmac, &pdev->dev);
if (ret) { if (ret) {
dev_err(&pdev->dev, "failed to parse OF data\n"); dev_err(&pdev->dev, "failed to parse OF data\n");
goto err_parse_dt; return ret;
} }
if (data->flags & STMMAC_FLAG_HWTSTAMP_CORRECT_LATENCY) if (data->flags & STMMAC_FLAG_HWTSTAMP_CORRECT_LATENCY)
...@@ -365,7 +364,7 @@ static int imx_dwmac_probe(struct platform_device *pdev) ...@@ -365,7 +364,7 @@ static int imx_dwmac_probe(struct platform_device *pdev)
ret = imx_dwmac_clks_config(dwmac, true); ret = imx_dwmac_clks_config(dwmac, true);
if (ret) if (ret)
goto err_clks_config; return ret;
ret = imx_dwmac_init(pdev, dwmac); ret = imx_dwmac_init(pdev, dwmac);
if (ret) if (ret)
...@@ -385,10 +384,6 @@ static int imx_dwmac_probe(struct platform_device *pdev) ...@@ -385,10 +384,6 @@ static int imx_dwmac_probe(struct platform_device *pdev)
imx_dwmac_exit(pdev, plat_dat->bsp_priv); imx_dwmac_exit(pdev, plat_dat->bsp_priv);
err_dwmac_init: err_dwmac_init:
imx_dwmac_clks_config(dwmac, false); imx_dwmac_clks_config(dwmac, false);
err_clks_config:
err_parse_dt:
err_match_data:
stmmac_remove_config_dt(pdev, plat_dat);
return ret; return ret;
} }
...@@ -423,7 +418,7 @@ MODULE_DEVICE_TABLE(of, imx_dwmac_match); ...@@ -423,7 +418,7 @@ MODULE_DEVICE_TABLE(of, imx_dwmac_match);
static struct platform_driver imx_dwmac_driver = { static struct platform_driver imx_dwmac_driver = {
.probe = imx_dwmac_probe, .probe = imx_dwmac_probe,
.remove_new = stmmac_pltfr_remove, .remove_new = stmmac_pltfr_remove_no_dt,
.driver = { .driver = {
.name = "imx-dwmac", .name = "imx-dwmac",
.pm = &stmmac_pltfr_pm_ops, .pm = &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