drivers/net/ethernet/litex/litex_liteeth.c | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-)
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
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
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
© 2016 - 2026 Red Hat, Inc.