netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCHv2 net-next 00/10] net: lantiq_etop: some cleanups
@ 2024-10-01 18:45 Rosen Penev
  2024-10-01 18:45 ` [PATCHv2 net-next 01/10] net: lantiq_etop: use netif_receive_skb_list Rosen Penev
                   ` (9 more replies)
  0 siblings, 10 replies; 19+ messages in thread
From: Rosen Penev @ 2024-10-01 18:45 UTC (permalink / raw)
  To: netdev
  Cc: andrew, davem, edumazet, kuba, pabeni, linux-kernel, olek2,
	shannon.nelson

Some basic cleanups to increase devm usage.

v2: fix typo in devm_platform_ioremap_resource

Rosen Penev (10):
  net: lantiq_etop: use netif_receive_skb_list
  net: lantiq_etop: use devm_alloc_etherdev_mqs
  net: lantiq_etop: use devm for register_netdev
  net: lantiq_etop: use devm for mdiobus
  net: lantiq_etop: move phy_disconnect to stop
  net: lantiq_etop: use devm_err_probe
  net: lantiq_etop: remove struct resource
  net: lantiq_etop: use module_platform_driver_probe
  net: lantiq_etop: no queue stop in remove
  net: lantiq_etop: return by register_netdev

 drivers/net/ethernet/lantiq_etop.c | 143 +++++++----------------------
 1 file changed, 34 insertions(+), 109 deletions(-)

-- 
2.46.2


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

* [PATCHv2 net-next 01/10] net: lantiq_etop: use netif_receive_skb_list
  2024-10-01 18:45 [PATCHv2 net-next 00/10] net: lantiq_etop: some cleanups Rosen Penev
@ 2024-10-01 18:45 ` Rosen Penev
  2024-10-01 22:40   ` Andrew Lunn
  2024-10-01 18:45 ` [PATCHv2 net-next 02/10] net: lantiq_etop: use devm_alloc_etherdev_mqs Rosen Penev
                   ` (8 subsequent siblings)
  9 siblings, 1 reply; 19+ messages in thread
From: Rosen Penev @ 2024-10-01 18:45 UTC (permalink / raw)
  To: netdev
  Cc: andrew, davem, edumazet, kuba, pabeni, linux-kernel, olek2,
	shannon.nelson

Improves cache efficiency by batching rx skb processing. Small
performance improvement on RX.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Reviewed-by: Shannon Nelson <shannon.nelson@amd.com>
---
 drivers/net/ethernet/lantiq_etop.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/lantiq_etop.c b/drivers/net/ethernet/lantiq_etop.c
index 3c289bfe0a09..94b37c12f3f7 100644
--- a/drivers/net/ethernet/lantiq_etop.c
+++ b/drivers/net/ethernet/lantiq_etop.c
@@ -122,8 +122,7 @@ ltq_etop_alloc_skb(struct ltq_etop_chan *ch)
 	return 0;
 }
 
-static void
-ltq_etop_hw_receive(struct ltq_etop_chan *ch)
+static void ltq_etop_hw_receive(struct ltq_etop_chan *ch, struct list_head *lh)
 {
 	struct ltq_etop_priv *priv = netdev_priv(ch->netdev);
 	struct ltq_dma_desc *desc = &ch->dma.desc_base[ch->dma.desc];
@@ -143,7 +142,7 @@ ltq_etop_hw_receive(struct ltq_etop_chan *ch)
 
 	skb_put(skb, len);
 	skb->protocol = eth_type_trans(skb, ch->netdev);
-	netif_receive_skb(skb);
+	list_add_tail(&skb->list, lh);
 }
 
 static int
@@ -151,6 +150,7 @@ ltq_etop_poll_rx(struct napi_struct *napi, int budget)
 {
 	struct ltq_etop_chan *ch = container_of(napi,
 				struct ltq_etop_chan, napi);
+	LIST_HEAD(rx_list);
 	int work_done = 0;
 
 	while (work_done < budget) {
@@ -158,9 +158,12 @@ ltq_etop_poll_rx(struct napi_struct *napi, int budget)
 
 		if ((desc->ctl & (LTQ_DMA_OWN | LTQ_DMA_C)) != LTQ_DMA_C)
 			break;
-		ltq_etop_hw_receive(ch);
+		ltq_etop_hw_receive(ch, &rx_list);
 		work_done++;
 	}
+
+	netif_receive_skb_list(&rx_list);
+
 	if (work_done < budget) {
 		napi_complete_done(&ch->napi, work_done);
 		ltq_dma_ack_irq(&ch->dma);
-- 
2.46.2


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

* [PATCHv2 net-next 02/10] net: lantiq_etop: use devm_alloc_etherdev_mqs
  2024-10-01 18:45 [PATCHv2 net-next 00/10] net: lantiq_etop: some cleanups Rosen Penev
  2024-10-01 18:45 ` [PATCHv2 net-next 01/10] net: lantiq_etop: use netif_receive_skb_list Rosen Penev
@ 2024-10-01 18:45 ` Rosen Penev
  2024-10-01 18:46 ` [PATCHv2 net-next 03/10] net: lantiq_etop: use devm for register_netdev Rosen Penev
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 19+ messages in thread
From: Rosen Penev @ 2024-10-01 18:45 UTC (permalink / raw)
  To: netdev
  Cc: andrew, davem, edumazet, kuba, pabeni, linux-kernel, olek2,
	shannon.nelson

It seems there's a missing free_netdev in the remove function. Just
avoid manual frees and use devm.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Reviewed-by: Shannon Nelson <shannon.nelson@amd.com>
---
 drivers/net/ethernet/lantiq_etop.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/drivers/net/ethernet/lantiq_etop.c b/drivers/net/ethernet/lantiq_etop.c
index 94b37c12f3f7..de4f75ce8d9d 100644
--- a/drivers/net/ethernet/lantiq_etop.c
+++ b/drivers/net/ethernet/lantiq_etop.c
@@ -601,7 +601,6 @@ ltq_etop_init(struct net_device *dev)
 
 err_netdev:
 	unregister_netdev(dev);
-	free_netdev(dev);
 err_hw:
 	ltq_etop_hw_exit(dev);
 	return err;
@@ -672,7 +671,8 @@ ltq_etop_probe(struct platform_device *pdev)
 		goto err_out;
 	}
 
-	dev = alloc_etherdev_mq(sizeof(struct ltq_etop_priv), 4);
+	dev = devm_alloc_etherdev_mqs(&pdev->dev, sizeof(struct ltq_etop_priv),
+				      4, 4);
 	if (!dev) {
 		err = -ENOMEM;
 		goto err_out;
@@ -690,13 +690,13 @@ ltq_etop_probe(struct platform_device *pdev)
 	err = device_property_read_u32(&pdev->dev, "lantiq,tx-burst-length", &priv->tx_burst_len);
 	if (err < 0) {
 		dev_err(&pdev->dev, "unable to read tx-burst-length property\n");
-		goto err_free;
+		goto err_out;
 	}
 
 	err = device_property_read_u32(&pdev->dev, "lantiq,rx-burst-length", &priv->rx_burst_len);
 	if (err < 0) {
 		dev_err(&pdev->dev, "unable to read rx-burst-length property\n");
-		goto err_free;
+		goto err_out;
 	}
 
 	for (i = 0; i < MAX_DMA_CHAN; i++) {
@@ -711,13 +711,11 @@ ltq_etop_probe(struct platform_device *pdev)
 
 	err = register_netdev(dev);
 	if (err)
-		goto err_free;
+		goto err_out;
 
 	platform_set_drvdata(pdev, dev);
 	return 0;
 
-err_free:
-	free_netdev(dev);
 err_out:
 	return err;
 }
-- 
2.46.2


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

* [PATCHv2 net-next 03/10] net: lantiq_etop: use devm for register_netdev
  2024-10-01 18:45 [PATCHv2 net-next 00/10] net: lantiq_etop: some cleanups Rosen Penev
  2024-10-01 18:45 ` [PATCHv2 net-next 01/10] net: lantiq_etop: use netif_receive_skb_list Rosen Penev
  2024-10-01 18:45 ` [PATCHv2 net-next 02/10] net: lantiq_etop: use devm_alloc_etherdev_mqs Rosen Penev
@ 2024-10-01 18:46 ` Rosen Penev
  2024-10-01 22:48   ` Andrew Lunn
  2024-10-01 18:46 ` [PATCHv2 net-next 04/10] net: lantiq_etop: use devm for mdiobus Rosen Penev
                   ` (6 subsequent siblings)
  9 siblings, 1 reply; 19+ messages in thread
From: Rosen Penev @ 2024-10-01 18:46 UTC (permalink / raw)
  To: netdev
  Cc: andrew, davem, edumazet, kuba, pabeni, linux-kernel, olek2,
	shannon.nelson

This is the last to be created and so must be the first to be freed.
Simpler to avoid by using devm.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Reviewed-by: Shannon Nelson <shannon.nelson@amd.com>
---
 drivers/net/ethernet/lantiq_etop.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ethernet/lantiq_etop.c b/drivers/net/ethernet/lantiq_etop.c
index de4f75ce8d9d..988f204fd89c 100644
--- a/drivers/net/ethernet/lantiq_etop.c
+++ b/drivers/net/ethernet/lantiq_etop.c
@@ -587,7 +587,7 @@ ltq_etop_init(struct net_device *dev)
 
 	err = ltq_etop_set_mac_address(dev, &mac);
 	if (err)
-		goto err_netdev;
+		goto err_hw;
 
 	/* Set addr_assign_type here, ltq_etop_set_mac_address would reset it. */
 	if (random_mac)
@@ -596,11 +596,9 @@ ltq_etop_init(struct net_device *dev)
 	ltq_etop_set_multicast_list(dev);
 	err = ltq_etop_mdio_init(dev);
 	if (err)
-		goto err_netdev;
+		goto err_hw;
 	return 0;
 
-err_netdev:
-	unregister_netdev(dev);
 err_hw:
 	ltq_etop_hw_exit(dev);
 	return err;
@@ -709,7 +707,7 @@ ltq_etop_probe(struct platform_device *pdev)
 		priv->ch[i].netdev = dev;
 	}
 
-	err = register_netdev(dev);
+	err = devm_register_netdev(&pdev->dev, dev);
 	if (err)
 		goto err_out;
 
@@ -728,7 +726,6 @@ static void ltq_etop_remove(struct platform_device *pdev)
 		netif_tx_stop_all_queues(dev);
 		ltq_etop_hw_exit(dev);
 		ltq_etop_mdio_cleanup(dev);
-		unregister_netdev(dev);
 	}
 }
 
-- 
2.46.2


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

* [PATCHv2 net-next 04/10] net: lantiq_etop: use devm for mdiobus
  2024-10-01 18:45 [PATCHv2 net-next 00/10] net: lantiq_etop: some cleanups Rosen Penev
                   ` (2 preceding siblings ...)
  2024-10-01 18:46 ` [PATCHv2 net-next 03/10] net: lantiq_etop: use devm for register_netdev Rosen Penev
@ 2024-10-01 18:46 ` Rosen Penev
  2024-10-01 22:51   ` Andrew Lunn
  2024-10-01 18:46 ` [PATCHv2 net-next 05/10] net: lantiq_etop: move phy_disconnect to stop Rosen Penev
                   ` (5 subsequent siblings)
  9 siblings, 1 reply; 19+ messages in thread
From: Rosen Penev @ 2024-10-01 18:46 UTC (permalink / raw)
  To: netdev
  Cc: andrew, davem, edumazet, kuba, pabeni, linux-kernel, olek2,
	shannon.nelson

Allows removing ltq_etop_mdio_cleanup. Kept the phy_disconnect in the
remove function just in case.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Reviewed-by: Shannon Nelson <shannon.nelson@amd.com>
---
 drivers/net/ethernet/lantiq_etop.c | 24 +++++-------------------
 1 file changed, 5 insertions(+), 19 deletions(-)

diff --git a/drivers/net/ethernet/lantiq_etop.c b/drivers/net/ethernet/lantiq_etop.c
index 988f204fd89c..d1fcbfd3e255 100644
--- a/drivers/net/ethernet/lantiq_etop.c
+++ b/drivers/net/ethernet/lantiq_etop.c
@@ -391,7 +391,7 @@ ltq_etop_mdio_init(struct net_device *dev)
 	struct ltq_etop_priv *priv = netdev_priv(dev);
 	int err;
 
-	priv->mii_bus = mdiobus_alloc();
+	priv->mii_bus = devm_mdiobus_alloc(&dev->dev);
 	if (!priv->mii_bus) {
 		netdev_err(dev, "failed to allocate mii bus\n");
 		err = -ENOMEM;
@@ -404,35 +404,21 @@ ltq_etop_mdio_init(struct net_device *dev)
 	priv->mii_bus->name = "ltq_mii";
 	snprintf(priv->mii_bus->id, MII_BUS_ID_SIZE, "%s-%x",
 		 priv->pdev->name, priv->pdev->id);
-	if (mdiobus_register(priv->mii_bus)) {
+	if (devm_mdiobus_register(&dev->dev, priv->mii_bus)) {
 		err = -ENXIO;
-		goto err_out_free_mdiobus;
+		goto err_out;
 	}
 
 	if (ltq_etop_mdio_probe(dev)) {
 		err = -ENXIO;
-		goto err_out_unregister_bus;
+		goto err_out;
 	}
 	return 0;
 
-err_out_unregister_bus:
-	mdiobus_unregister(priv->mii_bus);
-err_out_free_mdiobus:
-	mdiobus_free(priv->mii_bus);
 err_out:
 	return err;
 }
 
-static void
-ltq_etop_mdio_cleanup(struct net_device *dev)
-{
-	struct ltq_etop_priv *priv = netdev_priv(dev);
-
-	phy_disconnect(dev->phydev);
-	mdiobus_unregister(priv->mii_bus);
-	mdiobus_free(priv->mii_bus);
-}
-
 static int
 ltq_etop_open(struct net_device *dev)
 {
@@ -725,7 +711,7 @@ static void ltq_etop_remove(struct platform_device *pdev)
 	if (dev) {
 		netif_tx_stop_all_queues(dev);
 		ltq_etop_hw_exit(dev);
-		ltq_etop_mdio_cleanup(dev);
+		phy_disconnect(dev->phydev);
 	}
 }
 
-- 
2.46.2


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

* [PATCHv2 net-next 05/10] net: lantiq_etop: move phy_disconnect to stop
  2024-10-01 18:45 [PATCHv2 net-next 00/10] net: lantiq_etop: some cleanups Rosen Penev
                   ` (3 preceding siblings ...)
  2024-10-01 18:46 ` [PATCHv2 net-next 04/10] net: lantiq_etop: use devm for mdiobus Rosen Penev
@ 2024-10-01 18:46 ` Rosen Penev
  2024-10-01 22:56   ` Andrew Lunn
  2024-10-03 21:09   ` Aleksander Jan Bajkowski
  2024-10-01 18:46 ` [PATCHv2 net-next 06/10] net: lantiq_etop: use devm_err_probe Rosen Penev
                   ` (4 subsequent siblings)
  9 siblings, 2 replies; 19+ messages in thread
From: Rosen Penev @ 2024-10-01 18:46 UTC (permalink / raw)
  To: netdev
  Cc: andrew, davem, edumazet, kuba, pabeni, linux-kernel, olek2,
	shannon.nelson

phy is initialized in start, not in probe. Move to stop instead of
remove to disconnect it earlier.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Reviewed-by: Shannon Nelson <shannon.nelson@amd.com>
---
 drivers/net/ethernet/lantiq_etop.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/lantiq_etop.c b/drivers/net/ethernet/lantiq_etop.c
index d1fcbfd3e255..9ca8f01585f6 100644
--- a/drivers/net/ethernet/lantiq_etop.c
+++ b/drivers/net/ethernet/lantiq_etop.c
@@ -447,6 +447,7 @@ ltq_etop_stop(struct net_device *dev)
 
 	netif_tx_stop_all_queues(dev);
 	phy_stop(dev->phydev);
+	phy_disconnect(dev->phydev);
 	for (i = 0; i < MAX_DMA_CHAN; i++) {
 		struct ltq_etop_chan *ch = &priv->ch[i];
 
@@ -711,7 +712,6 @@ static void ltq_etop_remove(struct platform_device *pdev)
 	if (dev) {
 		netif_tx_stop_all_queues(dev);
 		ltq_etop_hw_exit(dev);
-		phy_disconnect(dev->phydev);
 	}
 }
 
-- 
2.46.2


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

* [PATCHv2 net-next 06/10] net: lantiq_etop: use devm_err_probe
  2024-10-01 18:45 [PATCHv2 net-next 00/10] net: lantiq_etop: some cleanups Rosen Penev
                   ` (4 preceding siblings ...)
  2024-10-01 18:46 ` [PATCHv2 net-next 05/10] net: lantiq_etop: move phy_disconnect to stop Rosen Penev
@ 2024-10-01 18:46 ` Rosen Penev
  2024-10-01 18:46 ` [PATCHv2 net-next 07/10] net: lantiq_etop: remove struct resource Rosen Penev
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 19+ messages in thread
From: Rosen Penev @ 2024-10-01 18:46 UTC (permalink / raw)
  To: netdev
  Cc: andrew, davem, edumazet, kuba, pabeni, linux-kernel, olek2,
	shannon.nelson

Also remove pointless gotos that just return as a result of devm
conversions.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Reviewed-by: Shannon Nelson <shannon.nelson@amd.com>
---
 drivers/net/ethernet/lantiq_etop.c | 61 ++++++++++--------------------
 1 file changed, 21 insertions(+), 40 deletions(-)

diff --git a/drivers/net/ethernet/lantiq_etop.c b/drivers/net/ethernet/lantiq_etop.c
index 9ca8f01585f6..bc97b189785e 100644
--- a/drivers/net/ethernet/lantiq_etop.c
+++ b/drivers/net/ethernet/lantiq_etop.c
@@ -389,13 +389,11 @@ static int
 ltq_etop_mdio_init(struct net_device *dev)
 {
 	struct ltq_etop_priv *priv = netdev_priv(dev);
-	int err;
 
 	priv->mii_bus = devm_mdiobus_alloc(&dev->dev);
 	if (!priv->mii_bus) {
 		netdev_err(dev, "failed to allocate mii bus\n");
-		err = -ENOMEM;
-		goto err_out;
+		return -ENOMEM;
 	}
 
 	priv->mii_bus->priv = dev;
@@ -404,19 +402,13 @@ ltq_etop_mdio_init(struct net_device *dev)
 	priv->mii_bus->name = "ltq_mii";
 	snprintf(priv->mii_bus->id, MII_BUS_ID_SIZE, "%s-%x",
 		 priv->pdev->name, priv->pdev->id);
-	if (devm_mdiobus_register(&dev->dev, priv->mii_bus)) {
-		err = -ENXIO;
-		goto err_out;
-	}
+	if (devm_mdiobus_register(&dev->dev, priv->mii_bus))
+		return -ENXIO;
 
-	if (ltq_etop_mdio_probe(dev)) {
-		err = -ENXIO;
-		goto err_out;
-	}
-	return 0;
+	if (ltq_etop_mdio_probe(dev))
+		return -ENXIO;
 
-err_out:
-	return err;
+	return 0;
 }
 
 static int
@@ -634,34 +626,28 @@ ltq_etop_probe(struct platform_device *pdev)
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	if (!res) {
-		dev_err(&pdev->dev, "failed to get etop resource\n");
-		err = -ENOENT;
-		goto err_out;
+		dev_err(&pdev->dev, "failed to get etop resource");
+		return -ENOENT;
 	}
 
 	res = devm_request_mem_region(&pdev->dev, res->start,
 				      resource_size(res), dev_name(&pdev->dev));
 	if (!res) {
-		dev_err(&pdev->dev, "failed to request etop resource\n");
-		err = -EBUSY;
-		goto err_out;
+		dev_err(&pdev->dev, "failed to request etop resource");
+		return -EBUSY;
 	}
 
 	ltq_etop_membase = devm_ioremap(&pdev->dev, res->start,
 					resource_size(res));
 	if (!ltq_etop_membase) {
-		dev_err(&pdev->dev, "failed to remap etop engine %d\n",
-			pdev->id);
-		err = -ENOMEM;
-		goto err_out;
+		dev_err(&pdev->dev, "failed to remap etop engine %d", pdev->id);
+		return -ENOMEM;
 	}
 
 	dev = devm_alloc_etherdev_mqs(&pdev->dev, sizeof(struct ltq_etop_priv),
 				      4, 4);
-	if (!dev) {
-		err = -ENOMEM;
-		goto err_out;
-	}
+	if (!dev)
+		return -ENOMEM;
 	dev->netdev_ops = &ltq_eth_netdev_ops;
 	dev->ethtool_ops = &ltq_etop_ethtool_ops;
 	priv = netdev_priv(dev);
@@ -673,16 +659,14 @@ ltq_etop_probe(struct platform_device *pdev)
 	SET_NETDEV_DEV(dev, &pdev->dev);
 
 	err = device_property_read_u32(&pdev->dev, "lantiq,tx-burst-length", &priv->tx_burst_len);
-	if (err < 0) {
-		dev_err(&pdev->dev, "unable to read tx-burst-length property\n");
-		goto err_out;
-	}
+	if (err < 0)
+		return dev_err_probe(&pdev->dev, err,
+				     "unable to read tx-burst-length property");
 
 	err = device_property_read_u32(&pdev->dev, "lantiq,rx-burst-length", &priv->rx_burst_len);
-	if (err < 0) {
-		dev_err(&pdev->dev, "unable to read rx-burst-length property\n");
-		goto err_out;
-	}
+	if (err < 0)
+		return dev_err_probe(&pdev->dev, err,
+				     "unable to read rx-burst-length property");
 
 	for (i = 0; i < MAX_DMA_CHAN; i++) {
 		if (IS_TX(i))
@@ -696,13 +680,10 @@ ltq_etop_probe(struct platform_device *pdev)
 
 	err = devm_register_netdev(&pdev->dev, dev);
 	if (err)
-		goto err_out;
+		return err;
 
 	platform_set_drvdata(pdev, dev);
 	return 0;
-
-err_out:
-	return err;
 }
 
 static void ltq_etop_remove(struct platform_device *pdev)
-- 
2.46.2


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

* [PATCHv2 net-next 07/10] net: lantiq_etop: remove struct resource
  2024-10-01 18:45 [PATCHv2 net-next 00/10] net: lantiq_etop: some cleanups Rosen Penev
                   ` (5 preceding siblings ...)
  2024-10-01 18:46 ` [PATCHv2 net-next 06/10] net: lantiq_etop: use devm_err_probe Rosen Penev
@ 2024-10-01 18:46 ` Rosen Penev
  2024-10-01 18:46 ` [PATCHv2 net-next 08/10] net: lantiq_etop: use module_platform_driver_probe Rosen Penev
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 19+ messages in thread
From: Rosen Penev @ 2024-10-01 18:46 UTC (permalink / raw)
  To: netdev
  Cc: andrew, davem, edumazet, kuba, pabeni, linux-kernel, olek2,
	shannon.nelson

All of this can be simplified with devm_platformn_ioremap_resource. No
need for extra code.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Reviewed-by: Shannon Nelson <shannon.nelson@amd.com>
---
 drivers/net/ethernet/lantiq_etop.c | 23 +++--------------------
 1 file changed, 3 insertions(+), 20 deletions(-)

diff --git a/drivers/net/ethernet/lantiq_etop.c b/drivers/net/ethernet/lantiq_etop.c
index bc97b189785e..3e9937c7371a 100644
--- a/drivers/net/ethernet/lantiq_etop.c
+++ b/drivers/net/ethernet/lantiq_etop.c
@@ -90,7 +90,6 @@ struct ltq_etop_priv {
 	struct net_device *netdev;
 	struct platform_device *pdev;
 	struct ltq_eth_data *pldata;
-	struct resource *res;
 
 	struct mii_bus *mii_bus;
 
@@ -620,28 +619,13 @@ ltq_etop_probe(struct platform_device *pdev)
 {
 	struct net_device *dev;
 	struct ltq_etop_priv *priv;
-	struct resource *res;
 	int err;
 	int i;
 
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	if (!res) {
-		dev_err(&pdev->dev, "failed to get etop resource");
-		return -ENOENT;
-	}
-
-	res = devm_request_mem_region(&pdev->dev, res->start,
-				      resource_size(res), dev_name(&pdev->dev));
-	if (!res) {
-		dev_err(&pdev->dev, "failed to request etop resource");
-		return -EBUSY;
-	}
-
-	ltq_etop_membase = devm_ioremap(&pdev->dev, res->start,
-					resource_size(res));
-	if (!ltq_etop_membase) {
+	ltq_etop_membase = devm_platform_ioremap_resource(pdev, 0);
+	if (IS_ERR(ltq_etop_membase)) {
 		dev_err(&pdev->dev, "failed to remap etop engine %d", pdev->id);
-		return -ENOMEM;
+		return PTR_ERR(ltq_etop_membase);
 	}
 
 	dev = devm_alloc_etherdev_mqs(&pdev->dev, sizeof(struct ltq_etop_priv),
@@ -651,7 +635,6 @@ ltq_etop_probe(struct platform_device *pdev)
 	dev->netdev_ops = &ltq_eth_netdev_ops;
 	dev->ethtool_ops = &ltq_etop_ethtool_ops;
 	priv = netdev_priv(dev);
-	priv->res = res;
 	priv->pdev = pdev;
 	priv->pldata = dev_get_platdata(&pdev->dev);
 	priv->netdev = dev;
-- 
2.46.2


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

* [PATCHv2 net-next 08/10] net: lantiq_etop: use module_platform_driver_probe
  2024-10-01 18:45 [PATCHv2 net-next 00/10] net: lantiq_etop: some cleanups Rosen Penev
                   ` (6 preceding siblings ...)
  2024-10-01 18:46 ` [PATCHv2 net-next 07/10] net: lantiq_etop: remove struct resource Rosen Penev
@ 2024-10-01 18:46 ` Rosen Penev
  2024-10-03 17:55   ` kernel test robot
  2024-10-03 23:26   ` kernel test robot
  2024-10-01 18:46 ` [PATCHv2 net-next 09/10] net: lantiq_etop: no queue stop in remove Rosen Penev
  2024-10-01 18:46 ` [PATCHv2 net-next 10/10] net: lantiq_etop: return by register_netdev Rosen Penev
  9 siblings, 2 replies; 19+ messages in thread
From: Rosen Penev @ 2024-10-01 18:46 UTC (permalink / raw)
  To: netdev
  Cc: andrew, davem, edumazet, kuba, pabeni, linux-kernel, olek2,
	shannon.nelson

The explicit init and exit functions don't do anything special. Just use
the macro.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Reviewed-by: Shannon Nelson <shannon.nelson@amd.com>
---
 drivers/net/ethernet/lantiq_etop.c | 19 +------------------
 1 file changed, 1 insertion(+), 18 deletions(-)

diff --git a/drivers/net/ethernet/lantiq_etop.c b/drivers/net/ethernet/lantiq_etop.c
index 3e9937c7371a..1458796c4e30 100644
--- a/drivers/net/ethernet/lantiq_etop.c
+++ b/drivers/net/ethernet/lantiq_etop.c
@@ -686,24 +686,7 @@ static struct platform_driver ltq_mii_driver = {
 	},
 };
 
-static int __init
-init_ltq_etop(void)
-{
-	int ret = platform_driver_probe(&ltq_mii_driver, ltq_etop_probe);
-
-	if (ret)
-		pr_err("ltq_etop: Error registering platform driver!");
-	return ret;
-}
-
-static void __exit
-exit_ltq_etop(void)
-{
-	platform_driver_unregister(&ltq_mii_driver);
-}
-
-module_init(init_ltq_etop);
-module_exit(exit_ltq_etop);
+module_platform_driver_probe(&ltq_mii_driver, ltq_etop_probe);
 
 MODULE_AUTHOR("John Crispin <blogic@openwrt.org>");
 MODULE_DESCRIPTION("Lantiq SoC ETOP");
-- 
2.46.2


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

* [PATCHv2 net-next 09/10] net: lantiq_etop: no queue stop in remove
  2024-10-01 18:45 [PATCHv2 net-next 00/10] net: lantiq_etop: some cleanups Rosen Penev
                   ` (7 preceding siblings ...)
  2024-10-01 18:46 ` [PATCHv2 net-next 08/10] net: lantiq_etop: use module_platform_driver_probe Rosen Penev
@ 2024-10-01 18:46 ` Rosen Penev
  2024-10-01 18:46 ` [PATCHv2 net-next 10/10] net: lantiq_etop: return by register_netdev Rosen Penev
  9 siblings, 0 replies; 19+ messages in thread
From: Rosen Penev @ 2024-10-01 18:46 UTC (permalink / raw)
  To: netdev
  Cc: andrew, davem, edumazet, kuba, pabeni, linux-kernel, olek2,
	shannon.nelson

This is already called in stop. No need to call a second time.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Reviewed-by: Shannon Nelson <shannon.nelson@amd.com>
---
 drivers/net/ethernet/lantiq_etop.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/lantiq_etop.c b/drivers/net/ethernet/lantiq_etop.c
index 1458796c4e30..355b96ecc5ec 100644
--- a/drivers/net/ethernet/lantiq_etop.c
+++ b/drivers/net/ethernet/lantiq_etop.c
@@ -673,10 +673,8 @@ static void ltq_etop_remove(struct platform_device *pdev)
 {
 	struct net_device *dev = platform_get_drvdata(pdev);
 
-	if (dev) {
-		netif_tx_stop_all_queues(dev);
+	if (dev)
 		ltq_etop_hw_exit(dev);
-	}
 }
 
 static struct platform_driver ltq_mii_driver = {
-- 
2.46.2


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

* [PATCHv2 net-next 10/10] net: lantiq_etop: return by register_netdev
  2024-10-01 18:45 [PATCHv2 net-next 00/10] net: lantiq_etop: some cleanups Rosen Penev
                   ` (8 preceding siblings ...)
  2024-10-01 18:46 ` [PATCHv2 net-next 09/10] net: lantiq_etop: no queue stop in remove Rosen Penev
@ 2024-10-01 18:46 ` Rosen Penev
  9 siblings, 0 replies; 19+ messages in thread
From: Rosen Penev @ 2024-10-01 18:46 UTC (permalink / raw)
  To: netdev
  Cc: andrew, davem, edumazet, kuba, pabeni, linux-kernel, olek2,
	shannon.nelson

Simpler to do so. The error is not handled anyways.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
 drivers/net/ethernet/lantiq_etop.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/lantiq_etop.c b/drivers/net/ethernet/lantiq_etop.c
index 355b96ecc5ec..cc5b94bc30b9 100644
--- a/drivers/net/ethernet/lantiq_etop.c
+++ b/drivers/net/ethernet/lantiq_etop.c
@@ -661,12 +661,8 @@ ltq_etop_probe(struct platform_device *pdev)
 		priv->ch[i].netdev = dev;
 	}
 
-	err = devm_register_netdev(&pdev->dev, dev);
-	if (err)
-		return err;
-
 	platform_set_drvdata(pdev, dev);
-	return 0;
+	return devm_register_netdev(&pdev->dev, dev);
 }
 
 static void ltq_etop_remove(struct platform_device *pdev)
-- 
2.46.2


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

* Re: [PATCHv2 net-next 01/10] net: lantiq_etop: use netif_receive_skb_list
  2024-10-01 18:45 ` [PATCHv2 net-next 01/10] net: lantiq_etop: use netif_receive_skb_list Rosen Penev
@ 2024-10-01 22:40   ` Andrew Lunn
  2024-10-01 23:39     ` Rosen Penev
  0 siblings, 1 reply; 19+ messages in thread
From: Andrew Lunn @ 2024-10-01 22:40 UTC (permalink / raw)
  To: Rosen Penev
  Cc: netdev, davem, edumazet, kuba, pabeni, linux-kernel, olek2,
	shannon.nelson

On Tue, Oct 01, 2024 at 11:45:58AM -0700, Rosen Penev wrote:
> Improves cache efficiency by batching rx skb processing. Small
> performance improvement on RX.

Benchmark numbers would be good.

> 
> Signed-off-by: Rosen Penev <rosenp@gmail.com>
> Reviewed-by: Shannon Nelson <shannon.nelson@amd.com>
> ---
>  drivers/net/ethernet/lantiq_etop.c | 11 +++++++----
>  1 file changed, 7 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/net/ethernet/lantiq_etop.c b/drivers/net/ethernet/lantiq_etop.c
> index 3c289bfe0a09..94b37c12f3f7 100644
> --- a/drivers/net/ethernet/lantiq_etop.c
> +++ b/drivers/net/ethernet/lantiq_etop.c
> @@ -122,8 +122,7 @@ ltq_etop_alloc_skb(struct ltq_etop_chan *ch)
>  	return 0;
>  }
>  
> -static void
> -ltq_etop_hw_receive(struct ltq_etop_chan *ch)
> +static void ltq_etop_hw_receive(struct ltq_etop_chan *ch, struct list_head *lh)

Please don't put the return type on the same line. If you look at this
driver, it is the coding style to always have it on a separate
line. You broken the coding style.


    Andrew

---
pw-bot: cr


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

* Re: [PATCHv2 net-next 03/10] net: lantiq_etop: use devm for register_netdev
  2024-10-01 18:46 ` [PATCHv2 net-next 03/10] net: lantiq_etop: use devm for register_netdev Rosen Penev
@ 2024-10-01 22:48   ` Andrew Lunn
  0 siblings, 0 replies; 19+ messages in thread
From: Andrew Lunn @ 2024-10-01 22:48 UTC (permalink / raw)
  To: Rosen Penev
  Cc: netdev, davem, edumazet, kuba, pabeni, linux-kernel, olek2,
	shannon.nelson

On Tue, Oct 01, 2024 at 11:46:00AM -0700, Rosen Penev wrote:
> This is the last to be created and so must be the first to be freed.
> Simpler to avoid by using devm.

Actually, devm does not enforce that. All it enforces is that
resources controlled via devm are released in reverse order. Things
not using devm will be release first by explicit code.

The only reason devm is safe is that the core ensures the interface is
closed. So the order probably does not matter.

    Andrew

---
pw-bot: cr

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

* Re: [PATCHv2 net-next 04/10] net: lantiq_etop: use devm for mdiobus
  2024-10-01 18:46 ` [PATCHv2 net-next 04/10] net: lantiq_etop: use devm for mdiobus Rosen Penev
@ 2024-10-01 22:51   ` Andrew Lunn
  0 siblings, 0 replies; 19+ messages in thread
From: Andrew Lunn @ 2024-10-01 22:51 UTC (permalink / raw)
  To: Rosen Penev
  Cc: netdev, davem, edumazet, kuba, pabeni, linux-kernel, olek2,
	shannon.nelson

On Tue, Oct 01, 2024 at 11:46:01AM -0700, Rosen Penev wrote:
> Allows removing ltq_etop_mdio_cleanup. Kept the phy_disconnect in the
> remove function just in case.
> 
> Signed-off-by: Rosen Penev <rosenp@gmail.com>
> Reviewed-by: Shannon Nelson <shannon.nelson@amd.com>

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

    Andrew

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

* Re: [PATCHv2 net-next 05/10] net: lantiq_etop: move phy_disconnect to stop
  2024-10-01 18:46 ` [PATCHv2 net-next 05/10] net: lantiq_etop: move phy_disconnect to stop Rosen Penev
@ 2024-10-01 22:56   ` Andrew Lunn
  2024-10-03 21:09   ` Aleksander Jan Bajkowski
  1 sibling, 0 replies; 19+ messages in thread
From: Andrew Lunn @ 2024-10-01 22:56 UTC (permalink / raw)
  To: Rosen Penev
  Cc: netdev, davem, edumazet, kuba, pabeni, linux-kernel, olek2,
	shannon.nelson

On Tue, Oct 01, 2024 at 11:46:02AM -0700, Rosen Penev wrote:
> phy is initialized in start, not in probe. Move to stop instead of
> remove to disconnect it earlier.

This commit message does not make any sense.


    Andrew

---
pw-bot: cr


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

* Re: [PATCHv2 net-next 01/10] net: lantiq_etop: use netif_receive_skb_list
  2024-10-01 22:40   ` Andrew Lunn
@ 2024-10-01 23:39     ` Rosen Penev
  0 siblings, 0 replies; 19+ messages in thread
From: Rosen Penev @ 2024-10-01 23:39 UTC (permalink / raw)
  To: Andrew Lunn
  Cc: netdev, davem, edumazet, kuba, pabeni, linux-kernel, olek2,
	shannon.nelson

On Tue, Oct 1, 2024 at 3:40 PM Andrew Lunn <andrew@lunn.ch> wrote:
>
> On Tue, Oct 01, 2024 at 11:45:58AM -0700, Rosen Penev wrote:
> > Improves cache efficiency by batching rx skb processing. Small
> > performance improvement on RX.
>
> Benchmark numbers would be good.
>
> >
> > Signed-off-by: Rosen Penev <rosenp@gmail.com>
> > Reviewed-by: Shannon Nelson <shannon.nelson@amd.com>
> > ---
> >  drivers/net/ethernet/lantiq_etop.c | 11 +++++++----
> >  1 file changed, 7 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/net/ethernet/lantiq_etop.c b/drivers/net/ethernet/lantiq_etop.c
> > index 3c289bfe0a09..94b37c12f3f7 100644
> > --- a/drivers/net/ethernet/lantiq_etop.c
> > +++ b/drivers/net/ethernet/lantiq_etop.c
> > @@ -122,8 +122,7 @@ ltq_etop_alloc_skb(struct ltq_etop_chan *ch)
> >       return 0;
> >  }
> >
> > -static void
> > -ltq_etop_hw_receive(struct ltq_etop_chan *ch)
> > +static void ltq_etop_hw_receive(struct ltq_etop_chan *ch, struct list_head *lh)
>
> Please don't put the return type on the same line. If you look at this
> driver, it is the coding style to always have it on a separate
> line. You broken the coding style.
I'm using git clang-format HEAD~1 on my commits. Something to improve I guess.
>
>
>     Andrew
>
> ---
> pw-bot: cr
>

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

* Re: [PATCHv2 net-next 08/10] net: lantiq_etop: use module_platform_driver_probe
  2024-10-01 18:46 ` [PATCHv2 net-next 08/10] net: lantiq_etop: use module_platform_driver_probe Rosen Penev
@ 2024-10-03 17:55   ` kernel test robot
  2024-10-03 23:26   ` kernel test robot
  1 sibling, 0 replies; 19+ messages in thread
From: kernel test robot @ 2024-10-03 17:55 UTC (permalink / raw)
  To: Rosen Penev, netdev
  Cc: oe-kbuild-all, andrew, davem, edumazet, kuba, pabeni,
	linux-kernel, olek2, shannon.nelson

Hi Rosen,

kernel test robot noticed the following build errors:

[auto build test ERROR on net-next/main]

url:    https://github.com/intel-lab-lkp/linux/commits/Rosen-Penev/net-lantiq_etop-use-netif_receive_skb_list/20241002-025104
base:   net-next/main
patch link:    https://lore.kernel.org/r/20241001184607.193461-9-rosenp%40gmail.com
patch subject: [PATCHv2 net-next 08/10] net: lantiq_etop: use module_platform_driver_probe
config: mips-xway_defconfig (https://download.01.org/0day-ci/archive/20241004/202410040101.1HX2nS2j-lkp@intel.com/config)
compiler: mips-linux-gcc (GCC) 13.3.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241004/202410040101.1HX2nS2j-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202410040101.1HX2nS2j-lkp@intel.com/

All error/warnings (new ones prefixed by >>):

   In file included from drivers/net/ethernet/lantiq_etop.c:21:
>> drivers/net/ethernet/lantiq_etop.c:689:30: error: expected identifier or '(' before '&' token
     689 | module_platform_driver_probe(&ltq_mii_driver, ltq_etop_probe);
         |                              ^
   include/linux/platform_device.h:320:19: note: in definition of macro 'module_platform_driver_probe'
     320 | static int __init __platform_driver##_init(void) \
         |                   ^~~~~~~~~~~~~~~~~
   In file included from <command-line>:
>> include/linux/init.h:214:17: error: pasting "_" and "&" does not give a valid preprocessing token
     214 |         __PASTE(_, fn))))))
         |                 ^
   include/linux/compiler_types.h:83:23: note: in definition of macro '___PASTE'
      83 | #define ___PASTE(a,b) a##b
         |                       ^
   include/linux/init.h:214:9: note: in expansion of macro '__PASTE'
     214 |         __PASTE(_, fn))))))
         |         ^~~~~~~
   include/linux/init.h:280:42: note: in expansion of macro '__initcall_id'
     280 |         __unique_initcall(fn, id, __sec, __initcall_id(fn))
         |                                          ^~~~~~~~~~~~~
   include/linux/init.h:282:35: note: in expansion of macro '___define_initcall'
     282 | #define __define_initcall(fn, id) ___define_initcall(fn, id, .initcall##id)
         |                                   ^~~~~~~~~~~~~~~~~~
   include/linux/init.h:311:41: note: in expansion of macro '__define_initcall'
     311 | #define device_initcall(fn)             __define_initcall(fn, 6)
         |                                         ^~~~~~~~~~~~~~~~~
   include/linux/init.h:316:24: note: in expansion of macro 'device_initcall'
     316 | #define __initcall(fn) device_initcall(fn)
         |                        ^~~~~~~~~~~~~~~
   include/linux/module.h:88:25: note: in expansion of macro '__initcall'
      88 | #define module_init(x)  __initcall(x);
         |                         ^~~~~~~~~~
   include/linux/platform_device.h:325:1: note: in expansion of macro 'module_init'
     325 | module_init(__platform_driver##_init); \
         | ^~~~~~~~~~~
   drivers/net/ethernet/lantiq_etop.c:689:1: note: in expansion of macro 'module_platform_driver_probe'
     689 | module_platform_driver_probe(&ltq_mii_driver, ltq_etop_probe);
         | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   In file included from include/linux/printk.h:6,
                    from include/linux/kernel.h:31,
                    from drivers/net/ethernet/lantiq_etop.c:7:
>> drivers/net/ethernet/lantiq_etop.c:689:30: error: expected '=', ',', ';', 'asm' or '__attribute__' before '&' token
     689 | module_platform_driver_probe(&ltq_mii_driver, ltq_etop_probe);
         |                              ^
   include/linux/init.h:269:27: note: in definition of macro '____define_initcall'
     269 |         static initcall_t __name __used                         \
         |                           ^~~~~~
   include/linux/compiler_types.h:84:22: note: in expansion of macro '___PASTE'
      84 | #define __PASTE(a,b) ___PASTE(a,b)
         |                      ^~~~~~~~
   include/linux/init.h:218:9: note: in expansion of macro '__PASTE'
     218 |         __PASTE(__,                                             \
         |         ^~~~~~~
   include/linux/compiler_types.h:84:22: note: in expansion of macro '___PASTE'
      84 | #define __PASTE(a,b) ___PASTE(a,b)
         |                      ^~~~~~~~
   include/linux/init.h:219:9: note: in expansion of macro '__PASTE'
     219 |         __PASTE(prefix,                                         \
         |         ^~~~~~~
   include/linux/compiler_types.h:84:22: note: in expansion of macro '___PASTE'
      84 | #define __PASTE(a,b) ___PASTE(a,b)
         |                      ^~~~~~~~
   include/linux/init.h:220:9: note: in expansion of macro '__PASTE'
     220 |         __PASTE(__,                                             \
         |         ^~~~~~~
   include/linux/compiler_types.h:84:22: note: in expansion of macro '___PASTE'
      84 | #define __PASTE(a,b) ___PASTE(a,b)
         |                      ^~~~~~~~
   include/linux/init.h:221:9: note: in expansion of macro '__PASTE'
     221 |         __PASTE(__iid, id))))
         |         ^~~~~~~
   include/linux/init.h:276:17: note: in expansion of macro '__initcall_name'
     276 |                 __initcall_name(initcall, __iid, id),           \
         |                 ^~~~~~~~~~~~~~~
   include/linux/init.h:280:9: note: in expansion of macro '__unique_initcall'
     280 |         __unique_initcall(fn, id, __sec, __initcall_id(fn))
         |         ^~~~~~~~~~~~~~~~~
   include/linux/compiler_types.h:84:22: note: in expansion of macro '___PASTE'
      84 | #define __PASTE(a,b) ___PASTE(a,b)
         |                      ^~~~~~~~
   include/linux/init.h:209:9: note: in expansion of macro '__PASTE'
     209 |         __PASTE(__KBUILD_MODNAME,                               \
         |         ^~~~~~~
   include/linux/compiler_types.h:84:22: note: in expansion of macro '___PASTE'
      84 | #define __PASTE(a,b) ___PASTE(a,b)
         |                      ^~~~~~~~
   include/linux/init.h:210:9: note: in expansion of macro '__PASTE'
     210 |         __PASTE(__,                                             \
         |         ^~~~~~~
   include/linux/compiler_types.h:84:22: note: in expansion of macro '___PASTE'
      84 | #define __PASTE(a,b) ___PASTE(a,b)
         |                      ^~~~~~~~
   include/linux/init.h:211:9: note: in expansion of macro '__PASTE'
     211 |         __PASTE(__COUNTER__,                                    \
         |         ^~~~~~~
   include/linux/compiler_types.h:84:22: note: in expansion of macro '___PASTE'
      84 | #define __PASTE(a,b) ___PASTE(a,b)
         |                      ^~~~~~~~
   include/linux/init.h:212:9: note: in expansion of macro '__PASTE'
     212 |         __PASTE(_,                                              \
         |         ^~~~~~~
   include/linux/compiler_types.h:84:22: note: in expansion of macro '___PASTE'
      84 | #define __PASTE(a,b) ___PASTE(a,b)
         |                      ^~~~~~~~
   include/linux/init.h:213:9: note: in expansion of macro '__PASTE'
     213 |         __PASTE(__LINE__,                                       \
         |         ^~~~~~~
   include/linux/compiler_types.h:84:22: note: in expansion of macro '___PASTE'
      84 | #define __PASTE(a,b) ___PASTE(a,b)
         |                      ^~~~~~~~
   include/linux/init.h:214:9: note: in expansion of macro '__PASTE'
     214 |         __PASTE(_, fn))))))
         |         ^~~~~~~
   include/linux/init.h:280:42: note: in expansion of macro '__initcall_id'
     280 |         __unique_initcall(fn, id, __sec, __initcall_id(fn))
         |                                          ^~~~~~~~~~~~~
   include/linux/init.h:282:35: note: in expansion of macro '___define_initcall'
     282 | #define __define_initcall(fn, id) ___define_initcall(fn, id, .initcall##id)
         |                                   ^~~~~~~~~~~~~~~~~~
   include/linux/init.h:311:41: note: in expansion of macro '__define_initcall'
     311 | #define device_initcall(fn)             __define_initcall(fn, 6)
         |                                         ^~~~~~~~~~~~~~~~~
   include/linux/init.h:316:24: note: in expansion of macro 'device_initcall'
     316 | #define __initcall(fn) device_initcall(fn)
         |                        ^~~~~~~~~~~~~~~
   include/linux/module.h:88:25: note: in expansion of macro '__initcall'
      88 | #define module_init(x)  __initcall(x);
         |                         ^~~~~~~~~~
   include/linux/platform_device.h:325:1: note: in expansion of macro 'module_init'
     325 | module_init(__platform_driver##_init); \
         | ^~~~~~~~~~~
   drivers/net/ethernet/lantiq_etop.c:689:1: note: in expansion of macro 'module_platform_driver_probe'
     689 | module_platform_driver_probe(&ltq_mii_driver, ltq_etop_probe);
         | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/net/ethernet/lantiq_etop.c:689:30: error: expected identifier or '(' before '&' token
     689 | module_platform_driver_probe(&ltq_mii_driver, ltq_etop_probe);
         |                              ^
   include/linux/platform_device.h:326:20: note: in definition of macro 'module_platform_driver_probe'
     326 | static void __exit __platform_driver##_exit(void) \
         |                    ^~~~~~~~~~~~~~~~~
>> include/linux/init.h:319:27: error: pasting "__exitcall_" and "&" does not give a valid preprocessing token
     319 |         static exitcall_t __exitcall_##fn __exit_call = fn
         |                           ^~~~~~~~~~~
   include/linux/module.h:100:25: note: in expansion of macro '__exitcall'
     100 | #define module_exit(x)  __exitcall(x);
         |                         ^~~~~~~~~~
   include/linux/platform_device.h:330:1: note: in expansion of macro 'module_exit'
     330 | module_exit(__platform_driver##_exit);
         | ^~~~~~~~~~~
   drivers/net/ethernet/lantiq_etop.c:689:1: note: in expansion of macro 'module_platform_driver_probe'
     689 | module_platform_driver_probe(&ltq_mii_driver, ltq_etop_probe);
         | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/net/ethernet/lantiq_etop.c:689:30: error: expected '=', ',', ';', 'asm' or '__attribute__' before '&' token
     689 | module_platform_driver_probe(&ltq_mii_driver, ltq_etop_probe);
         |                              ^
   include/linux/init.h:319:40: note: in definition of macro '__exitcall'
     319 |         static exitcall_t __exitcall_##fn __exit_call = fn
         |                                        ^~
   include/linux/platform_device.h:330:1: note: in expansion of macro 'module_exit'
     330 | module_exit(__platform_driver##_exit);
         | ^~~~~~~~~~~
   drivers/net/ethernet/lantiq_etop.c:689:1: note: in expansion of macro 'module_platform_driver_probe'
     689 | module_platform_driver_probe(&ltq_mii_driver, ltq_etop_probe);
         | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/net/ethernet/lantiq_etop.c:682:31: warning: 'ltq_mii_driver' defined but not used [-Wunused-variable]
     682 | static struct platform_driver ltq_mii_driver = {
         |                               ^~~~~~~~~~~~~~
>> drivers/net/ethernet/lantiq_etop.c:618:1: warning: 'ltq_etop_probe' defined but not used [-Wunused-function]
     618 | ltq_etop_probe(struct platform_device *pdev)
         | ^~~~~~~~~~~~~~


vim +689 drivers/net/ethernet/lantiq_etop.c

   616	
   617	static int __init
 > 618	ltq_etop_probe(struct platform_device *pdev)
   619	{
   620		struct net_device *dev;
   621		struct ltq_etop_priv *priv;
   622		int err;
   623		int i;
   624	
   625		ltq_etop_membase = devm_platform_ioremap_resource(pdev, 0);
   626		if (IS_ERR(ltq_etop_membase)) {
   627			dev_err(&pdev->dev, "failed to remap etop engine %d", pdev->id);
   628			return PTR_ERR(ltq_etop_membase);
   629		}
   630	
   631		dev = devm_alloc_etherdev_mqs(&pdev->dev, sizeof(struct ltq_etop_priv),
   632					      4, 4);
   633		if (!dev)
   634			return -ENOMEM;
   635		dev->netdev_ops = &ltq_eth_netdev_ops;
   636		dev->ethtool_ops = &ltq_etop_ethtool_ops;
   637		priv = netdev_priv(dev);
   638		priv->pdev = pdev;
   639		priv->pldata = dev_get_platdata(&pdev->dev);
   640		priv->netdev = dev;
   641		spin_lock_init(&priv->lock);
   642		SET_NETDEV_DEV(dev, &pdev->dev);
   643	
   644		err = device_property_read_u32(&pdev->dev, "lantiq,tx-burst-length", &priv->tx_burst_len);
   645		if (err < 0)
   646			return dev_err_probe(&pdev->dev, err,
   647					     "unable to read tx-burst-length property");
   648	
   649		err = device_property_read_u32(&pdev->dev, "lantiq,rx-burst-length", &priv->rx_burst_len);
   650		if (err < 0)
   651			return dev_err_probe(&pdev->dev, err,
   652					     "unable to read rx-burst-length property");
   653	
   654		for (i = 0; i < MAX_DMA_CHAN; i++) {
   655			if (IS_TX(i))
   656				netif_napi_add_weight(dev, &priv->ch[i].napi,
   657						      ltq_etop_poll_tx, 8);
   658			else if (IS_RX(i))
   659				netif_napi_add_weight(dev, &priv->ch[i].napi,
   660						      ltq_etop_poll_rx, 32);
   661			priv->ch[i].netdev = dev;
   662		}
   663	
   664		err = devm_register_netdev(&pdev->dev, dev);
   665		if (err)
   666			return err;
   667	
   668		platform_set_drvdata(pdev, dev);
   669		return 0;
   670	}
   671	
   672	static void ltq_etop_remove(struct platform_device *pdev)
   673	{
   674		struct net_device *dev = platform_get_drvdata(pdev);
   675	
   676		if (dev) {
   677			netif_tx_stop_all_queues(dev);
   678			ltq_etop_hw_exit(dev);
   679		}
   680	}
   681	
 > 682	static struct platform_driver ltq_mii_driver = {
   683		.remove_new = ltq_etop_remove,
   684		.driver = {
   685			.name = "ltq_etop",
   686		},
   687	};
   688	
 > 689	module_platform_driver_probe(&ltq_mii_driver, ltq_etop_probe);
   690	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

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

* Re: [PATCHv2 net-next 05/10] net: lantiq_etop: move phy_disconnect to stop
  2024-10-01 18:46 ` [PATCHv2 net-next 05/10] net: lantiq_etop: move phy_disconnect to stop Rosen Penev
  2024-10-01 22:56   ` Andrew Lunn
@ 2024-10-03 21:09   ` Aleksander Jan Bajkowski
  1 sibling, 0 replies; 19+ messages in thread
From: Aleksander Jan Bajkowski @ 2024-10-03 21:09 UTC (permalink / raw)
  To: Rosen Penev, netdev
  Cc: andrew, davem, edumazet, kuba, pabeni, linux-kernel,
	shannon.nelson

Hi Rosen,

On 1.10.2024 20:46, Rosen Penev wrote:
> phy is initialized in start, not in probe. Move to stop instead of
> remove to disconnect it earlier.
>
> Signed-off-by: Rosen Penev <rosenp@gmail.com>
> Reviewed-by: Shannon Nelson <shannon.nelson@amd.com>
> ---
>   drivers/net/ethernet/lantiq_etop.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/lantiq_etop.c b/drivers/net/ethernet/lantiq_etop.c
> index d1fcbfd3e255..9ca8f01585f6 100644
> --- a/drivers/net/ethernet/lantiq_etop.c
> +++ b/drivers/net/ethernet/lantiq_etop.c
> @@ -447,6 +447,7 @@ ltq_etop_stop(struct net_device *dev)
>   
>   	netif_tx_stop_all_queues(dev);
>   	phy_stop(dev->phydev);
> +	phy_disconnect(dev->phydev);


Phy_disconnect() already calls phy_stop(). The second call is redundant.


Regards,
Aleksander


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

* Re: [PATCHv2 net-next 08/10] net: lantiq_etop: use module_platform_driver_probe
  2024-10-01 18:46 ` [PATCHv2 net-next 08/10] net: lantiq_etop: use module_platform_driver_probe Rosen Penev
  2024-10-03 17:55   ` kernel test robot
@ 2024-10-03 23:26   ` kernel test robot
  1 sibling, 0 replies; 19+ messages in thread
From: kernel test robot @ 2024-10-03 23:26 UTC (permalink / raw)
  To: Rosen Penev, netdev
  Cc: llvm, oe-kbuild-all, andrew, davem, edumazet, kuba, pabeni,
	linux-kernel, olek2, shannon.nelson

Hi Rosen,

kernel test robot noticed the following build errors:

[auto build test ERROR on net-next/main]

url:    https://github.com/intel-lab-lkp/linux/commits/Rosen-Penev/net-lantiq_etop-use-netif_receive_skb_list/20241002-025104
base:   net-next/main
patch link:    https://lore.kernel.org/r/20241001184607.193461-9-rosenp%40gmail.com
patch subject: [PATCHv2 net-next 08/10] net: lantiq_etop: use module_platform_driver_probe
config: mips-xway_defconfig (https://download.01.org/0day-ci/archive/20241004/202410040710.C5horFtF-lkp@intel.com/config)
compiler: clang version 20.0.0git (https://github.com/llvm/llvm-project fef3566a25ff0e34fb87339ba5e13eca17cec00f)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241004/202410040710.C5horFtF-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202410040710.C5horFtF-lkp@intel.com/

All errors (new ones prefixed by >>):

   In file included from drivers/net/ethernet/lantiq_etop.c:14:
   In file included from include/linux/netdevice.h:38:
   In file included from include/net/net_namespace.h:43:
   In file included from include/linux/skbuff.h:17:
   In file included from include/linux/bvec.h:10:
   In file included from include/linux/highmem.h:8:
   In file included from include/linux/cacheflush.h:5:
   In file included from arch/mips/include/asm/cacheflush.h:13:
   In file included from include/linux/mm.h:2213:
   include/linux/vmstat.h:518:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
     518 |         return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
         |                               ~~~~~~~~~~~ ^ ~~~
>> drivers/net/ethernet/lantiq_etop.c:689:30: error: expected identifier or '('
     689 | module_platform_driver_probe(&ltq_mii_driver, ltq_etop_probe);
         |                              ^
>> drivers/net/ethernet/lantiq_etop.c:689:1: error: pasting formed '_&', an invalid preprocessing token
     689 | module_platform_driver_probe(&ltq_mii_driver, ltq_etop_probe);
         | ^
   include/linux/platform_device.h:324:3: note: expanded from macro 'module_platform_driver_probe'
     324 | } \
         |   ^
   include/linux/module.h:88:24: note: expanded from macro '\
   module_init'
      88 | #define module_init(x)  __initcall(x);
         |                         ^
   include/linux/init.h:316:24: note: expanded from macro '__initcall'
     316 | #define __initcall(fn) device_initcall(fn)
         |                        ^
   note: (skipping 3 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all)
   include/linux/init.h:214:2: note: expanded from macro '__initcall_id'
     214 |         __PASTE(_, fn))))))
         |         ^
   include/linux/compiler_types.h:84:22: note: expanded from macro '__PASTE'
      84 | #define __PASTE(a,b) ___PASTE(a,b)
         |                      ^
   include/linux/compiler_types.h:83:24: note: expanded from macro '___PASTE'
      83 | #define ___PASTE(a,b) a##b
         |                        ^
>> drivers/net/ethernet/lantiq_etop.c:689:30: error: expected ';' after top level declarator
     689 | module_platform_driver_probe(&ltq_mii_driver, ltq_etop_probe);
         |                              ^
>> drivers/net/ethernet/lantiq_etop.c:689:30: error: expected identifier or '('
>> drivers/net/ethernet/lantiq_etop.c:689:1: error: pasting formed '__exitcall_&', an invalid preprocessing token
     689 | module_platform_driver_probe(&ltq_mii_driver, ltq_etop_probe);
         | ^
   include/linux/platform_device.h:329:3: note: expanded from macro 'module_platform_driver_probe'
     329 | } \
         |   ^
   include/linux/module.h:100:24: note: expanded from macro '\
   module_exit'
     100 | #define module_exit(x)  __exitcall(x);
         |                         ^
   include/linux/init.h:319:31: note: expanded from macro '__exitcall'
     319 |         static exitcall_t __exitcall_##fn __exit_call = fn
         |                                      ^
>> drivers/net/ethernet/lantiq_etop.c:689:30: error: expected ';' after top level declarator
     689 | module_platform_driver_probe(&ltq_mii_driver, ltq_etop_probe);
         |                              ^
   1 warning and 6 errors generated.


vim +689 drivers/net/ethernet/lantiq_etop.c

   688	
 > 689	module_platform_driver_probe(&ltq_mii_driver, ltq_etop_probe);
   690	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

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

end of thread, other threads:[~2024-10-03 23:27 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-01 18:45 [PATCHv2 net-next 00/10] net: lantiq_etop: some cleanups Rosen Penev
2024-10-01 18:45 ` [PATCHv2 net-next 01/10] net: lantiq_etop: use netif_receive_skb_list Rosen Penev
2024-10-01 22:40   ` Andrew Lunn
2024-10-01 23:39     ` Rosen Penev
2024-10-01 18:45 ` [PATCHv2 net-next 02/10] net: lantiq_etop: use devm_alloc_etherdev_mqs Rosen Penev
2024-10-01 18:46 ` [PATCHv2 net-next 03/10] net: lantiq_etop: use devm for register_netdev Rosen Penev
2024-10-01 22:48   ` Andrew Lunn
2024-10-01 18:46 ` [PATCHv2 net-next 04/10] net: lantiq_etop: use devm for mdiobus Rosen Penev
2024-10-01 22:51   ` Andrew Lunn
2024-10-01 18:46 ` [PATCHv2 net-next 05/10] net: lantiq_etop: move phy_disconnect to stop Rosen Penev
2024-10-01 22:56   ` Andrew Lunn
2024-10-03 21:09   ` Aleksander Jan Bajkowski
2024-10-01 18:46 ` [PATCHv2 net-next 06/10] net: lantiq_etop: use devm_err_probe Rosen Penev
2024-10-01 18:46 ` [PATCHv2 net-next 07/10] net: lantiq_etop: remove struct resource Rosen Penev
2024-10-01 18:46 ` [PATCHv2 net-next 08/10] net: lantiq_etop: use module_platform_driver_probe Rosen Penev
2024-10-03 17:55   ` kernel test robot
2024-10-03 23:26   ` kernel test robot
2024-10-01 18:46 ` [PATCHv2 net-next 09/10] net: lantiq_etop: no queue stop in remove Rosen Penev
2024-10-01 18:46 ` [PATCHv2 net-next 10/10] net: lantiq_etop: return by register_netdev Rosen Penev

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).