* [PATCH net-next v2 1/4] net: stmmac: anarion: clean up anarion_config_dt() error handling
2025-04-14 9:05 [PATCH v2 net-next 0/4] net: stmmac: anarion: cleanups Russell King (Oracle)
@ 2025-04-14 9:06 ` Russell King (Oracle)
2025-04-14 9:06 ` [PATCH net-next v2 2/4] net: stmmac: anarion: clean up interface parsing Russell King (Oracle)
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Russell King (Oracle) @ 2025-04-14 9:06 UTC (permalink / raw)
To: Andrew Lunn, Heiner Kallweit
Cc: Alexandre Torgue, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, linux-arm-kernel, linux-stm32, Maxime Coquelin,
netdev, Paolo Abeni
When enabled, print a user friendly description of the error when
failing to ioremap() the control resource, and use ERR_CAST() when
propagating the error. This allows us to get rid of the "err" local
variable in anarion_config_dt().
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
drivers/net/ethernet/stmicro/stmmac/dwmac-anarion.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-anarion.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-anarion.c
index 37fe7c288878..232aae752690 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-anarion.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-anarion.c
@@ -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);
--
2.30.2
^ permalink raw reply related [flat|nested] 6+ messages in thread* [PATCH net-next v2 2/4] net: stmmac: anarion: clean up interface parsing
2025-04-14 9:05 [PATCH v2 net-next 0/4] net: stmmac: anarion: cleanups Russell King (Oracle)
2025-04-14 9:06 ` [PATCH net-next v2 1/4] net: stmmac: anarion: clean up anarion_config_dt() error handling Russell King (Oracle)
@ 2025-04-14 9:06 ` Russell King (Oracle)
2025-04-14 9:06 ` [PATCH net-next v2 3/4] net: stmmac: anarion: use stmmac_pltfr_probe() Russell King (Oracle)
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Russell King (Oracle) @ 2025-04-14 9:06 UTC (permalink / raw)
To: Andrew Lunn, Heiner Kallweit
Cc: Alexandre Torgue, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, linux-arm-kernel, linux-stm32, Maxime Coquelin,
netdev, Paolo Abeni
anarion_config_dt() used a switch statement to check for the RGMII
modes, complete with an unnecessary "fallthrough", and also printed
the numerical value of the PHY interface mode on error. Clean this
up using the phy_interface_mode_is_rgmii() helper, and print the
English version of the PHY interface mode on error.
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
.../net/ethernet/stmicro/stmmac/dwmac-anarion.c | 14 ++++----------
1 file changed, 4 insertions(+), 10 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-anarion.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-anarion.c
index 232aae752690..941ea724c643 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-anarion.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-anarion.c
@@ -79,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);
}
--
2.30.2
^ permalink raw reply related [flat|nested] 6+ messages in thread* [PATCH net-next v2 3/4] net: stmmac: anarion: use stmmac_pltfr_probe()
2025-04-14 9:05 [PATCH v2 net-next 0/4] net: stmmac: anarion: cleanups Russell King (Oracle)
2025-04-14 9:06 ` [PATCH net-next v2 1/4] net: stmmac: anarion: clean up anarion_config_dt() error handling Russell King (Oracle)
2025-04-14 9:06 ` [PATCH net-next v2 2/4] net: stmmac: anarion: clean up interface parsing Russell King (Oracle)
@ 2025-04-14 9:06 ` Russell King (Oracle)
2025-04-14 9:06 ` [PATCH net-next v2 4/4] net: stmmac: anarion: use devm_stmmac_pltfr_probe() Russell King (Oracle)
2025-04-15 15:40 ` [PATCH v2 net-next 0/4] net: stmmac: anarion: cleanups patchwork-bot+netdevbpf
4 siblings, 0 replies; 6+ messages in thread
From: Russell King (Oracle) @ 2025-04-14 9:06 UTC (permalink / raw)
To: Andrew Lunn, Heiner Kallweit
Cc: Alexandre Torgue, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, linux-arm-kernel, linux-stm32, Maxime Coquelin,
netdev, Paolo Abeni
Rather than open-coding the call to anarion_gmac_init() and then
stmmac_dvr_probe(), omitting the cleanup of calling
anarion_gmac_exit(), use stmmac_pltfr_probe() which will handle this
for us.
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
drivers/net/ethernet/stmicro/stmmac/dwmac-anarion.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-anarion.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-anarion.c
index 941ea724c643..99f6c977ec41 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-anarion.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-anarion.c
@@ -111,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 stmmac_pltfr_probe(pdev, plat_dat, &stmmac_res);
}
static const struct of_device_id anarion_dwmac_match[] = {
--
2.30.2
^ permalink raw reply related [flat|nested] 6+ messages in thread* [PATCH net-next v2 4/4] net: stmmac: anarion: use devm_stmmac_pltfr_probe()
2025-04-14 9:05 [PATCH v2 net-next 0/4] net: stmmac: anarion: cleanups Russell King (Oracle)
` (2 preceding siblings ...)
2025-04-14 9:06 ` [PATCH net-next v2 3/4] net: stmmac: anarion: use stmmac_pltfr_probe() Russell King (Oracle)
@ 2025-04-14 9:06 ` Russell King (Oracle)
2025-04-15 15:40 ` [PATCH v2 net-next 0/4] net: stmmac: anarion: cleanups patchwork-bot+netdevbpf
4 siblings, 0 replies; 6+ messages in thread
From: Russell King (Oracle) @ 2025-04-14 9:06 UTC (permalink / raw)
To: Andrew Lunn, Heiner Kallweit
Cc: Alexandre Torgue, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, linux-arm-kernel, linux-stm32, Maxime Coquelin,
netdev, Paolo Abeni
Convert anarion to use devm_stmmac_pltfr_probe() which allows the
removal of an explicit call to stmmac_pltfr_remove().
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
drivers/net/ethernet/stmicro/stmmac/dwmac-anarion.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-anarion.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-anarion.c
index 99f6c977ec41..84072c8ed741 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-anarion.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-anarion.c
@@ -113,7 +113,7 @@ static int anarion_dwmac_probe(struct platform_device *pdev)
plat_dat->exit = anarion_gmac_exit;
plat_dat->bsp_priv = gmac;
- return stmmac_pltfr_probe(pdev, plat_dat, &stmmac_res);
+ return devm_stmmac_pltfr_probe(pdev, plat_dat, &stmmac_res);
}
static const struct of_device_id anarion_dwmac_match[] = {
@@ -124,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,
--
2.30.2
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: [PATCH v2 net-next 0/4] net: stmmac: anarion: cleanups
2025-04-14 9:05 [PATCH v2 net-next 0/4] net: stmmac: anarion: cleanups Russell King (Oracle)
` (3 preceding siblings ...)
2025-04-14 9:06 ` [PATCH net-next v2 4/4] net: stmmac: anarion: use devm_stmmac_pltfr_probe() Russell King (Oracle)
@ 2025-04-15 15:40 ` patchwork-bot+netdevbpf
4 siblings, 0 replies; 6+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-04-15 15:40 UTC (permalink / raw)
To: Russell King
Cc: andrew, hkallweit1, alexandre.torgue, andrew+netdev, davem,
edumazet, kuba, linux-arm-kernel, linux-stm32, mcoquelin.stm32,
netdev, pabeni
Hello:
This series was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Mon, 14 Apr 2025 10:05:56 +0100 you wrote:
> 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.
>
> [...]
Here is the summary with links:
- [net-next,v2,1/4] net: stmmac: anarion: clean up anarion_config_dt() error handling
https://git.kernel.org/netdev/net-next/c/c30a45a7e072
- [net-next,v2,2/4] net: stmmac: anarion: clean up interface parsing
https://git.kernel.org/netdev/net-next/c/a55ec9c811aa
- [net-next,v2,3/4] net: stmmac: anarion: use stmmac_pltfr_probe()
https://git.kernel.org/netdev/net-next/c/5956527e26ff
- [net-next,v2,4/4] net: stmmac: anarion: use devm_stmmac_pltfr_probe()
https://git.kernel.org/netdev/net-next/c/a1afabef915c
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 6+ messages in thread