Merge branch 'net-stmmac-anarion-cleanups'

Russell King says:

====================
net: stmmac: anarion: cleanups

A series of cleanups to the anarion glue driver.

Clean up anarion_config_dt() error handling, printing a human readable
error rather than the numeric errno, and use ERR_CAST().

Using a switch statement with incorrect "fallthrough;" for RGMII vs
non-RGMII is unnecessary when we have phy_interface_mode_is_rgmii().
Convert to use the helper.

Use stmmac_pltfr_probe() rahter than open-coding the call to the
init function (which stmmac_pltfr_probe() will do for us.)

Finally, convert to use devm_stmmac_pltfr_probe() which allows the
removal of the .remove initialiser in the driver structure.

Not tested on hardware.
====================

Link: https://patch.msgid.link/Z_zP9BvZlqeq3Ssl@shell.armlinux.org.uk
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
Jakub Kicinski 2025-04-15 08:36:04 -07:00
commit 9d9bc1a464

View File

@ -65,13 +65,12 @@ anarion_config_dt(struct platform_device *pdev,
{
struct anarion_gmac *gmac;
void __iomem *ctl_block;
int err;
ctl_block = devm_platform_ioremap_resource(pdev, 1);
if (IS_ERR(ctl_block)) {
err = PTR_ERR(ctl_block);
dev_err(&pdev->dev, "Cannot get reset region (%d)!\n", err);
return ERR_PTR(err);
dev_err(&pdev->dev, "Cannot get reset region (%pe)!\n",
ctl_block);
return ERR_CAST(ctl_block);
}
gmac = devm_kzalloc(&pdev->dev, sizeof(*gmac), GFP_KERNEL);
@ -80,17 +79,11 @@ anarion_config_dt(struct platform_device *pdev,
gmac->ctl_block = ctl_block;
switch (plat_dat->phy_interface) {
case PHY_INTERFACE_MODE_RGMII:
fallthrough;
case PHY_INTERFACE_MODE_RGMII_ID:
case PHY_INTERFACE_MODE_RGMII_RXID:
case PHY_INTERFACE_MODE_RGMII_TXID:
if (phy_interface_mode_is_rgmii(plat_dat->phy_interface)) {
gmac->phy_intf_sel = GMAC_CONFIG_INTF_RGMII;
break;
default:
dev_err(&pdev->dev, "Unsupported phy-mode (%d)\n",
plat_dat->phy_interface);
} else {
dev_err(&pdev->dev, "Unsupported phy-mode (%s)\n",
phy_modes(plat_dat->phy_interface));
return ERR_PTR(-ENOTSUPP);
}
@ -118,10 +111,9 @@ static int anarion_dwmac_probe(struct platform_device *pdev)
plat_dat->init = anarion_gmac_init;
plat_dat->exit = anarion_gmac_exit;
anarion_gmac_init(pdev, gmac);
plat_dat->bsp_priv = gmac;
return stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res);
return devm_stmmac_pltfr_probe(pdev, plat_dat, &stmmac_res);
}
static const struct of_device_id anarion_dwmac_match[] = {
@ -132,7 +124,6 @@ MODULE_DEVICE_TABLE(of, anarion_dwmac_match);
static struct platform_driver anarion_dwmac_driver = {
.probe = anarion_dwmac_probe,
.remove = stmmac_pltfr_remove,
.driver = {
.name = "anarion-dwmac",
.pm = &stmmac_pltfr_pm_ops,