Skip to content

Commit d336a11

Browse files
xhackerustcdavem330
authored andcommitted
net: stmmac: dwmac-visconti: use devm_stmmac_probe_config_dt()
Simplify the driver's probe() function by using the devres variant of stmmac_probe_config_dt(). The calling of stmmac_pltfr_remove() now needs to be switched to stmmac_pltfr_remove_no_dt(). Signed-off-by: Jisheng Zhang <jszhang@kernel.org> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent acf73cc commit d336a11

1 file changed

Lines changed: 5 additions & 14 deletions

File tree

drivers/net/ethernet/stmicro/stmmac/dwmac-visconti.c

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -220,15 +220,13 @@ static int visconti_eth_dwmac_probe(struct platform_device *pdev)
220220
if (ret)
221221
return ret;
222222

223-
plat_dat = stmmac_probe_config_dt(pdev, stmmac_res.mac);
223+
plat_dat = devm_stmmac_probe_config_dt(pdev, stmmac_res.mac);
224224
if (IS_ERR(plat_dat))
225225
return PTR_ERR(plat_dat);
226226

227227
dwmac = devm_kzalloc(&pdev->dev, sizeof(*dwmac), GFP_KERNEL);
228-
if (!dwmac) {
229-
ret = -ENOMEM;
230-
goto remove_config;
231-
}
228+
if (!dwmac)
229+
return -ENOMEM;
232230

233231
spin_lock_init(&dwmac->lock);
234232
dwmac->reg = stmmac_res.addr;
@@ -238,7 +236,7 @@ static int visconti_eth_dwmac_probe(struct platform_device *pdev)
238236

239237
ret = visconti_eth_clock_probe(pdev, plat_dat);
240238
if (ret)
241-
goto remove_config;
239+
return ret;
242240

243241
visconti_eth_init_hw(pdev, plat_dat);
244242

@@ -252,22 +250,15 @@ static int visconti_eth_dwmac_probe(struct platform_device *pdev)
252250

253251
remove:
254252
visconti_eth_clock_remove(pdev);
255-
remove_config:
256-
stmmac_remove_config_dt(pdev, plat_dat);
257253

258254
return ret;
259255
}
260256

261257
static void visconti_eth_dwmac_remove(struct platform_device *pdev)
262258
{
263-
struct net_device *ndev = platform_get_drvdata(pdev);
264-
struct stmmac_priv *priv = netdev_priv(ndev);
265-
266-
stmmac_pltfr_remove(pdev);
259+
stmmac_pltfr_remove_no_dt(pdev);
267260

268261
visconti_eth_clock_remove(pdev);
269-
270-
stmmac_remove_config_dt(pdev, priv->plat);
271262
}
272263

273264
static const struct of_device_id visconti_eth_dwmac_match[] = {

0 commit comments

Comments
 (0)