public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next] net: ethernet: litex: use devm_register_netdev() to register netdev
@ 2026-01-16  0:31 Inochi Amaoto
  2026-01-16 17:20 ` Andrew Lunn
  0 siblings, 1 reply; 3+ messages in thread
From: Inochi Amaoto @ 2026-01-16  0:31 UTC (permalink / raw)
  To: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Karol Gugala, Mateusz Holenko, Gabriel Somlo,
	Joel Stanley
  Cc: Inochi Amaoto, netdev, linux-kernel, Yixun Lan, Longbin Li

Use devm_register_netdev to avoid unnecessary remove() callback in
platform_driver structure.

Signed-off-by: Inochi Amaoto <inochiama@gmail.com>
---
 drivers/net/ethernet/litex/litex_liteeth.c | 19 ++++++-------------
 1 file changed, 6 insertions(+), 13 deletions(-)

diff --git a/drivers/net/ethernet/litex/litex_liteeth.c b/drivers/net/ethernet/litex/litex_liteeth.c
index 829a4b828f8e..0de166528641 100644
--- a/drivers/net/ethernet/litex/litex_liteeth.c
+++ b/drivers/net/ethernet/litex/litex_liteeth.c
@@ -232,12 +232,13 @@ static void liteeth_setup_slots(struct liteeth *priv)
 
 static int liteeth_probe(struct platform_device *pdev)
 {
+	struct device *dev = &pdev->dev;
 	struct net_device *netdev;
 	void __iomem *buf_base;
 	struct liteeth *priv;
 	int irq, err;
 
-	netdev = devm_alloc_etherdev(&pdev->dev, sizeof(*priv));
+	netdev = devm_alloc_etherdev(dev, sizeof(*priv));
 	if (!netdev)
 		return -ENOMEM;
 
@@ -248,7 +249,7 @@ static int liteeth_probe(struct platform_device *pdev)
 	priv->netdev = netdev;
 	priv->dev = &pdev->dev;
 
-	netdev->tstats = devm_netdev_alloc_pcpu_stats(&pdev->dev,
+	netdev->tstats = devm_netdev_alloc_pcpu_stats(dev,
 						      struct pcpu_sw_netstats);
 	if (!netdev->tstats)
 		return -ENOMEM;
@@ -276,15 +277,15 @@ static int liteeth_probe(struct platform_device *pdev)
 	priv->tx_base = buf_base + priv->num_rx_slots * priv->slot_size;
 	priv->tx_slot = 0;
 
-	err = of_get_ethdev_address(pdev->dev.of_node, netdev);
+	err = of_get_ethdev_address(dev->of_node, netdev);
 	if (err)
 		eth_hw_addr_random(netdev);
 
 	netdev->netdev_ops = &liteeth_netdev_ops;
 
-	err = register_netdev(netdev);
+	err = devm_register_netdev(dev, netdev);
 	if (err) {
-		dev_err(&pdev->dev, "Failed to register netdev %d\n", err);
+		dev_err(dev, "Failed to register netdev %d\n", err);
 		return err;
 	}
 
@@ -294,13 +295,6 @@ static int liteeth_probe(struct platform_device *pdev)
 	return 0;
 }
 
-static void liteeth_remove(struct platform_device *pdev)
-{
-	struct net_device *netdev = platform_get_drvdata(pdev);
-
-	unregister_netdev(netdev);
-}
-
 static const struct of_device_id liteeth_of_match[] = {
 	{ .compatible = "litex,liteeth" },
 	{ }
@@ -309,7 +303,6 @@ MODULE_DEVICE_TABLE(of, liteeth_of_match);
 
 static struct platform_driver liteeth_driver = {
 	.probe = liteeth_probe,
-	.remove = liteeth_remove,
 	.driver = {
 		.name = DRV_NAME,
 		.of_match_table = liteeth_of_match,
-- 
2.52.0


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

* Re: [PATCH net-next] net: ethernet: litex: use devm_register_netdev() to register netdev
  2026-01-16  0:31 [PATCH net-next] net: ethernet: litex: use devm_register_netdev() to register netdev Inochi Amaoto
@ 2026-01-16 17:20 ` Andrew Lunn
  2026-01-17  0:30   ` Inochi Amaoto
  0 siblings, 1 reply; 3+ messages in thread
From: Andrew Lunn @ 2026-01-16 17:20 UTC (permalink / raw)
  To: Inochi Amaoto
  Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Karol Gugala, Mateusz Holenko, Gabriel Somlo,
	Joel Stanley, netdev, linux-kernel, Yixun Lan, Longbin Li

On Fri, Jan 16, 2026 at 08:31:50AM +0800, Inochi Amaoto wrote:
> Use devm_register_netdev to avoid unnecessary remove() callback in
> platform_driver structure.

> -	netdev = devm_alloc_etherdev(&pdev->dev, sizeof(*priv));
> +	netdev = devm_alloc_etherdev(dev, sizeof(*priv));
>  	if (!netdev)
>  		return -ENOMEM;

The commit message does not fit the actual change.

You probably want to split this into multiple patches. Ideally you
want lots of small patches with good commit messages which are
obviously correct.

    Andrew

---
pw-bot: cr

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

* Re: [PATCH net-next] net: ethernet: litex: use devm_register_netdev() to register netdev
  2026-01-16 17:20 ` Andrew Lunn
@ 2026-01-17  0:30   ` Inochi Amaoto
  0 siblings, 0 replies; 3+ messages in thread
From: Inochi Amaoto @ 2026-01-17  0:30 UTC (permalink / raw)
  To: Andrew Lunn, Inochi Amaoto
  Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Karol Gugala, Mateusz Holenko, Gabriel Somlo,
	Joel Stanley, netdev, linux-kernel, Yixun Lan, Longbin Li

On Fri, Jan 16, 2026 at 06:20:05PM +0100, Andrew Lunn wrote:
> On Fri, Jan 16, 2026 at 08:31:50AM +0800, Inochi Amaoto wrote:
> > Use devm_register_netdev to avoid unnecessary remove() callback in
> > platform_driver structure.
> 
> > -	netdev = devm_alloc_etherdev(&pdev->dev, sizeof(*priv));
> > +	netdev = devm_alloc_etherdev(dev, sizeof(*priv));
> >  	if (!netdev)
> >  		return -ENOMEM;
> 
> The commit message does not fit the actual change.
> 
> You probably want to split this into multiple patches. Ideally you
> want lots of small patches with good commit messages which are
> obviously correct.
> 

In fact, I just change them by the way and it is not a obvious change,
OK, I will split it and send a new version.

Regards,
Inochi

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

end of thread, other threads:[~2026-01-17  0:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-16  0:31 [PATCH net-next] net: ethernet: litex: use devm_register_netdev() to register netdev Inochi Amaoto
2026-01-16 17:20 ` Andrew Lunn
2026-01-17  0:30   ` Inochi Amaoto

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox