linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next 1/2] net: stmmac: ingenic: convert to stmmac_pltfr_pm_ops
  2025-04-14 15:51 [PATCH net-next 0/2] net: stmmac: ingenic: cleanups Russell King (Oracle)
@ 2025-04-14 15:51 ` Russell King (Oracle)
  2025-04-14 17:30   ` Andrew Lunn
  2025-04-14 15:51 ` [PATCH net-next 2/2] net: stmmac: ingenic: convert to devm_stmmac_pltfr_probe() Russell King (Oracle)
  2025-04-15 15:40 ` [PATCH net-next 0/2] net: stmmac: ingenic: cleanups patchwork-bot+netdevbpf
  2 siblings, 1 reply; 6+ messages in thread
From: Russell King (Oracle) @ 2025-04-14 15:51 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 the Ingenic glue driver to use the generic stmmac platform
power management operations.

In order to do this, we need to make ingenic_mac_init() arguments
compatible with plat_dat->init() by adding a plat_dat member to struct
ingenic_mac. This allows the custom suspend/resume operations to be
removed, and the PM ops pointer replaced with stmmac_pltfr_pm_ops.

This will adds runtime PM and noirq suspend/resume ops to this driver.

Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
 .../ethernet/stmicro/stmmac/dwmac-ingenic.c   | 41 ++++---------------
 1 file changed, 8 insertions(+), 33 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-ingenic.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-ingenic.c
index 066783d66422..607e467324a4 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-ingenic.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-ingenic.c
@@ -56,6 +56,7 @@ enum ingenic_mac_version {
 
 struct ingenic_mac {
 	const struct ingenic_soc_info *soc_info;
+	struct plat_stmmacenet_data *plat_dat;
 	struct device *dev;
 	struct regmap *regmap;
 
@@ -70,13 +71,13 @@ struct ingenic_soc_info {
 	int (*set_mode)(struct plat_stmmacenet_data *plat_dat);
 };
 
-static int ingenic_mac_init(struct plat_stmmacenet_data *plat_dat)
+static int ingenic_mac_init(struct platform_device *pdev, void *bsp_priv)
 {
-	struct ingenic_mac *mac = plat_dat->bsp_priv;
+	struct ingenic_mac *mac = bsp_priv;
 	int ret;
 
 	if (mac->soc_info->set_mode) {
-		ret = mac->soc_info->set_mode(plat_dat);
+		ret = mac->soc_info->set_mode(mac->plat_dat);
 		if (ret)
 			return ret;
 	}
@@ -284,44 +285,18 @@ static int ingenic_mac_probe(struct platform_device *pdev)
 
 	mac->soc_info = data;
 	mac->dev = &pdev->dev;
+	mac->plat_dat = plat_dat;
 
 	plat_dat->bsp_priv = mac;
+	plat_dat->init = ingenic_mac_init;
 
-	ret = ingenic_mac_init(plat_dat);
+	ret = ingenic_mac_init(pdev, mac);
 	if (ret)
 		return ret;
 
 	return stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res);
 }
 
-#ifdef CONFIG_PM_SLEEP
-static int ingenic_mac_suspend(struct device *dev)
-{
-	int ret;
-
-	ret = stmmac_suspend(dev);
-
-	return ret;
-}
-
-static int ingenic_mac_resume(struct device *dev)
-{
-	struct net_device *ndev = dev_get_drvdata(dev);
-	struct stmmac_priv *priv = netdev_priv(ndev);
-	int ret;
-
-	ret = ingenic_mac_init(priv->plat);
-	if (ret)
-		return ret;
-
-	ret = stmmac_resume(dev);
-
-	return ret;
-}
-#endif /* CONFIG_PM_SLEEP */
-
-static SIMPLE_DEV_PM_OPS(ingenic_mac_pm_ops, ingenic_mac_suspend, ingenic_mac_resume);
-
 static struct ingenic_soc_info jz4775_soc_info = {
 	.version = ID_JZ4775,
 	.mask = MACPHYC_TXCLK_SEL_MASK | MACPHYC_SOFT_RST_MASK | MACPHYC_PHY_INFT_MASK,
@@ -373,7 +348,7 @@ static struct platform_driver ingenic_mac_driver = {
 	.remove		= stmmac_pltfr_remove,
 	.driver		= {
 		.name	= "ingenic-mac",
-		.pm		= pm_ptr(&ingenic_mac_pm_ops),
+		.pm		= &stmmac_pltfr_pm_ops,
 		.of_match_table = ingenic_mac_of_matches,
 	},
 };
-- 
2.30.2



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH net-next 2/2] net: stmmac: ingenic: convert to devm_stmmac_pltfr_probe()
  2025-04-14 15:51 [PATCH net-next 0/2] net: stmmac: ingenic: cleanups Russell King (Oracle)
  2025-04-14 15:51 ` [PATCH net-next 1/2] net: stmmac: ingenic: convert to stmmac_pltfr_pm_ops Russell King (Oracle)
@ 2025-04-14 15:51 ` Russell King (Oracle)
  2025-04-14 17:30   ` Andrew Lunn
  2025-04-15 15:40 ` [PATCH net-next 0/2] net: stmmac: ingenic: cleanups patchwork-bot+netdevbpf
  2 siblings, 1 reply; 6+ messages in thread
From: Russell King (Oracle) @ 2025-04-14 15:51 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

As Ingenic now uses the stmmac platform PM ops, convert it to use
devm_stmmac_pltfr_probe() which will call the plat_dat->init() method
before stmmac_drv_probe() and appropriately cleaning up via the
->exit() method, thus simplifying the code. Using the devm_*()
variant also allows removal of the explicit call to
stmmac_pltfr_remove().

Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
 drivers/net/ethernet/stmicro/stmmac/dwmac-ingenic.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-ingenic.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-ingenic.c
index 607e467324a4..15abe214131f 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-ingenic.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-ingenic.c
@@ -290,11 +290,7 @@ static int ingenic_mac_probe(struct platform_device *pdev)
 	plat_dat->bsp_priv = mac;
 	plat_dat->init = ingenic_mac_init;
 
-	ret = ingenic_mac_init(pdev, mac);
-	if (ret)
-		return ret;
-
-	return stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res);
+	return devm_stmmac_pltfr_probe(pdev, plat_dat, &stmmac_res);
 }
 
 static struct ingenic_soc_info jz4775_soc_info = {
@@ -345,7 +341,6 @@ MODULE_DEVICE_TABLE(of, ingenic_mac_of_matches);
 
 static struct platform_driver ingenic_mac_driver = {
 	.probe		= ingenic_mac_probe,
-	.remove		= stmmac_pltfr_remove,
 	.driver		= {
 		.name	= "ingenic-mac",
 		.pm		= &stmmac_pltfr_pm_ops,
-- 
2.30.2



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH net-next 0/2] net: stmmac: ingenic: cleanups
@ 2025-04-14 15:51 Russell King (Oracle)
  2025-04-14 15:51 ` [PATCH net-next 1/2] net: stmmac: ingenic: convert to stmmac_pltfr_pm_ops Russell King (Oracle)
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Russell King (Oracle) @ 2025-04-14 15:51 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

Hi,

Another series for another stmmac glue platform.

Convert Ingenic to use the stmmac platform PM ops and the
devm_stmmac_pltfr_probe() helper.

 .../net/ethernet/stmicro/stmmac/dwmac-ingenic.c    | 46 ++++------------------
 1 file changed, 8 insertions(+), 38 deletions(-)

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH net-next 2/2] net: stmmac: ingenic: convert to devm_stmmac_pltfr_probe()
  2025-04-14 15:51 ` [PATCH net-next 2/2] net: stmmac: ingenic: convert to devm_stmmac_pltfr_probe() Russell King (Oracle)
@ 2025-04-14 17:30   ` Andrew Lunn
  0 siblings, 0 replies; 6+ messages in thread
From: Andrew Lunn @ 2025-04-14 17:30 UTC (permalink / raw)
  To: Russell King (Oracle)
  Cc: Heiner Kallweit, Alexandre Torgue, Andrew Lunn, David S. Miller,
	Eric Dumazet, Jakub Kicinski, linux-arm-kernel, linux-stm32,
	Maxime Coquelin, netdev, Paolo Abeni

On Mon, Apr 14, 2025 at 04:51:06PM +0100, Russell King (Oracle) wrote:
> As Ingenic now uses the stmmac platform PM ops, convert it to use
> devm_stmmac_pltfr_probe() which will call the plat_dat->init() method
> before stmmac_drv_probe() and appropriately cleaning up via the
> ->exit() method, thus simplifying the code. Using the devm_*()
> variant also allows removal of the explicit call to
> stmmac_pltfr_remove().
> 
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH net-next 1/2] net: stmmac: ingenic: convert to stmmac_pltfr_pm_ops
  2025-04-14 15:51 ` [PATCH net-next 1/2] net: stmmac: ingenic: convert to stmmac_pltfr_pm_ops Russell King (Oracle)
@ 2025-04-14 17:30   ` Andrew Lunn
  0 siblings, 0 replies; 6+ messages in thread
From: Andrew Lunn @ 2025-04-14 17:30 UTC (permalink / raw)
  To: Russell King (Oracle)
  Cc: Heiner Kallweit, Alexandre Torgue, Andrew Lunn, David S. Miller,
	Eric Dumazet, Jakub Kicinski, linux-arm-kernel, linux-stm32,
	Maxime Coquelin, netdev, Paolo Abeni

On Mon, Apr 14, 2025 at 04:51:01PM +0100, Russell King (Oracle) wrote:
> Convert the Ingenic glue driver to use the generic stmmac platform
> power management operations.
> 
> In order to do this, we need to make ingenic_mac_init() arguments
> compatible with plat_dat->init() by adding a plat_dat member to struct
> ingenic_mac. This allows the custom suspend/resume operations to be
> removed, and the PM ops pointer replaced with stmmac_pltfr_pm_ops.
> 
> This will adds runtime PM and noirq suspend/resume ops to this driver.
> 
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH net-next 0/2] net: stmmac: ingenic: cleanups
  2025-04-14 15:51 [PATCH net-next 0/2] net: stmmac: ingenic: cleanups Russell King (Oracle)
  2025-04-14 15:51 ` [PATCH net-next 1/2] net: stmmac: ingenic: convert to stmmac_pltfr_pm_ops Russell King (Oracle)
  2025-04-14 15:51 ` [PATCH net-next 2/2] net: stmmac: ingenic: convert to devm_stmmac_pltfr_probe() Russell King (Oracle)
@ 2025-04-15 15:40 ` patchwork-bot+netdevbpf
  2 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 16:51:18 +0100 you wrote:
> Hi,
> 
> Another series for another stmmac glue platform.
> 
> Convert Ingenic to use the stmmac platform PM ops and the
> devm_stmmac_pltfr_probe() helper.
> 
> [...]

Here is the summary with links:
  - [net-next,1/2] net: stmmac: ingenic: convert to stmmac_pltfr_pm_ops
    https://git.kernel.org/netdev/net-next/c/debfcb3f5848
  - [net-next,2/2] net: stmmac: ingenic: convert to devm_stmmac_pltfr_probe()
    https://git.kernel.org/netdev/net-next/c/96f8bf85d11a

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

end of thread, other threads:[~2025-04-15 16:11 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-14 15:51 [PATCH net-next 0/2] net: stmmac: ingenic: cleanups Russell King (Oracle)
2025-04-14 15:51 ` [PATCH net-next 1/2] net: stmmac: ingenic: convert to stmmac_pltfr_pm_ops Russell King (Oracle)
2025-04-14 17:30   ` Andrew Lunn
2025-04-14 15:51 ` [PATCH net-next 2/2] net: stmmac: ingenic: convert to devm_stmmac_pltfr_probe() Russell King (Oracle)
2025-04-14 17:30   ` Andrew Lunn
2025-04-15 15:40 ` [PATCH net-next 0/2] net: stmmac: ingenic: cleanups patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).