net: lantiq_etop: some cleanups
Subsystems (2)
v2 cover net: lantiq_etop: some cleanups
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(-)
Signature · 1 line
2.46.2
PATCH v2 1/10 net: lantiq_etop: use netif_receive_skb_list
Improves cache efficiency by batching rx skb processing. Small performance improvement on RX.
--- drivers/net/ethernet/lantiq_etop.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
drivers/net/ethernet/lantiq_etop.c +7 -4
@@ -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);
Signature · 1 line
2.46.2
Re: [PATCHv2 net-next 01/10] net: lantiq_etop: use netif_receive_skb_list
Quoted 2 lines · Rosen Penev
Improves cache efficiency by batching rx skb processing. Small performance improvement on RX.
Benchmark numbers would be good.
Quoted 12 lines
Signed-off-by Rosen Penev <[email protected]>Reviewed-by Shannon Nelson <[email protected]>--- drivers/net/ethernet/lantiq_etop.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)drivers/net/ethernet/lantiq_etop.c +0
-0
drivers/net/ethernet/lantiq_etop.c ltq_etop_alloc_skb(struct ltq_etop_chan *ch) · line 125
Quoted 6 lines
drivers/net/ethernet/lantiq_etop.c +1
-2@@ -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
Re: [PATCHv2 net-next 01/10] net: lantiq_etop: use netif_receive_skb_list
Quoted 22 lines · Andrew Lunn
Quoted 2 lines · Rosen Penev
Improves cache efficiency by batching rx skb processing. Small performance improvement on RX.
Benchmark numbers would be good.
Quoted 15 lines
Signed-off-by Rosen Penev <[email protected]>Reviewed-by Shannon Nelson <[email protected]>--- drivers/net/ethernet/lantiq_etop.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)drivers/net/ethernet/lantiq_etop.c +0
-0@@ -122,8 +122,7 @@ ltq_etop_alloc_skb(struct ltq_etop_chan *ch)return 0 ; }
Quoted 7 lines
drivers/net/ethernet/lantiq_etop.c ltq_etop_alloc_skb(struct ltq_etop_chan *ch) · line 125
Quoted 3 lines
drivers/net/ethernet/lantiq_etop.c +1
-2-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.
Quoted 7 lines
Andrew
---
pw-bot: cr
PATCH v2 2/10 net: lantiq_etop: use devm_alloc_etherdev_mqs
In reply to Rosen PenevIt seems there's a missing free_netdev in the remove function. Just avoid manual frees and use devm.
--- drivers/net/ethernet/lantiq_etop.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-)
drivers/net/ethernet/lantiq_etop.c +5 -7
@@ -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; }
Signature · 1 line
2.46.2
PATCH v2 3/10 net: lantiq_etop: use devm for register_netdev
In reply to Rosen PenevThis is the last to be created and so must be the first to be freed. Simpler to avoid by using devm.
--- drivers/net/ethernet/lantiq_etop.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)
drivers/net/ethernet/lantiq_etop.c +3 -6
@@ -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); } }
Signature · 1 line
2.46.2
Re: [PATCHv2 net-next 03/10] net: lantiq_etop: use devm for register_netdev
Quoted 2 lines · Rosen Penev
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
PATCH v2 4/10 net: lantiq_etop: use devm for mdiobus
In reply to Rosen PenevAllows removing ltq_etop_mdio_cleanup. Kept the phy_disconnect in the remove function just in case.
--- drivers/net/ethernet/lantiq_etop.c | 24 +++++------------------- 1 file changed, 5 insertions(+), 19 deletions(-)
drivers/net/ethernet/lantiq_etop.c +5 -19
@@ -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); } }
Signature · 1 line
2.46.2
Re: [PATCHv2 net-next 04/10] net: lantiq_etop: use devm for mdiobus
Quoted 5 lines · Rosen Penev
Allows removing
ltq_etop_mdio_cleanup. Kept thephy_disconnectin the remove function just in case.Signed-off-by Rosen Penev <[email protected]>Reviewed-by Shannon Nelson <[email protected]>
Andrew
PATCH v2 5/10 net: lantiq_etop: move phy_disconnect to stop
In reply to Rosen Penevphy is initialized in start, not in probe. Move to stop instead of remove to disconnect it earlier.
--- drivers/net/ethernet/lantiq_etop.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/lantiq_etop.c +1 -1
@@ -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); } }
Signature · 1 line
2.46.2
Re: [PATCHv2 net-next 05/10] net: lantiq_etop: move phy_disconnect to stop
Quoted 2 lines · Rosen Penev
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
Re: [PATCHv2 net-next 05/10] net: lantiq_etop: move phy_disconnect to stop
In reply to Rosen PenevHi Rosen,
Quoted 14 lines · Rosen Penev
phy is initialized in start, not in probe. Move to stop instead of remove to disconnect it earlier.
Signed-off-by Rosen Penev <[email protected]>Reviewed-by Shannon Nelson <[email protected]>--- drivers/net/ethernet/lantiq_etop.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/net/ethernet/lantiq_etop.c +0
-0
drivers/net/ethernet/lantiq_etop.c ltq_etop_stop(struct net_device *dev) · line 450
Quoted 4 lines
drivers/net/ethernet/lantiq_etop.c +1
-0@@ -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
PATCH v2 6/10 net: lantiq_etop: use devm_err_probe
In reply to Rosen PenevAlso remove pointless gotos that just return as a result of devm conversions.
--- drivers/net/ethernet/lantiq_etop.c | 61 ++++++++++-------------------- 1 file changed, 21 insertions(+), 40 deletions(-)
drivers/net/ethernet/lantiq_etop.c +21 -40
@@ -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 = <q_eth_netdev_ops; dev->ethtool_ops = <q_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)
Signature · 1 line
2.46.2
PATCH v2 7/10 net: lantiq_etop: remove struct resource
In reply to Rosen PenevAll of this can be simplified with devm_platformn_ioremap_resource. No need for extra code.
--- drivers/net/ethernet/lantiq_etop.c | 23 +++-------------------- 1 file changed, 3 insertions(+), 20 deletions(-)
drivers/net/ethernet/lantiq_etop.c +3 -20
@@ -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 = <q_eth_netdev_ops; dev->ethtool_ops = <q_etop_ethtool_ops; priv =netdev_priv (dev); - priv->res = res; priv->pdev = pdev; priv->pldata =dev_get_platdata (&pdev->dev); priv->netdev = dev;
Signature · 1 line
2.46.2
PATCH v2 8/10 net: lantiq_etop: use module_platform_driver_probe
In reply to Rosen PenevThe explicit init and exit functions don't do anything special. Just use the macro.
--- drivers/net/ethernet/lantiq_etop.c | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-)
drivers/net/ethernet/lantiq_etop.c +1 -18
@@ -686,24 +686,7 @@ static struct platform_driver ltq_mii_driver = { }, }; -static int __init -init_ltq_etop (void ) -{ -int ret =platform_driver_probe (<q_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 (<q_mii_driver); -} - -module_init (init_ltq_etop); -module_exit (exit_ltq_etop); +module_platform_driver_probe (<q_mii_driver, ltq_etop_probe);MODULE_AUTHOR ("John Crispin <[email protected]>" );MODULE_DESCRIPTION ("Lantiq SoC ETOP" );
Signature · 1 line
2.46.2
kernel test robot
build botRe: [PATCHv2 net-next 08/10] net: lantiq_etop: use module_platform_driver_probe
kernel test robot noticed the following build errors:
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/[email protected]/config) compiler: mips-linux-gcc (GCC) 13.3.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241004/[email protected]/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 <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
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(<q_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(<q_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(<q_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(<q_mii_driver, ltq_etop_probe);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/net/ethernet/lantiq_etop.c:689:30: error: expected identifier or '(' before '&' token
689 | module_platform_driver_probe(<q_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(<q_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(<q_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(<q_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 = <q_eth_netdev_ops;
636 dev->ethtool_ops = <q_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(<q_mii_driver, ltq_etop_probe);690
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
kernel test robot
build botRe: [PATCHv2 net-next 08/10] net: lantiq_etop: use module_platform_driver_probe
In reply to Rosen Penevkernel test robot noticed the following build errors:
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/[email protected]/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/[email protected]/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 <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
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(<q_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(<q_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(<q_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(<q_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(<q_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(<q_mii_driver, ltq_etop_probe);
690
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
PATCH v2 9/10 net: lantiq_etop: no queue stop in remove
In reply to Rosen PenevThis is already called in stop. No need to call a second time.
--- drivers/net/ethernet/lantiq_etop.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/net/ethernet/lantiq_etop.c +1 -3
@@ -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 = {
Signature · 1 line
2.46.2
PATCH v2 10/10 net: lantiq_etop: return by register_netdev
In reply to Rosen PenevSimpler to do so. The error is not handled anyways.
--- drivers/net/ethernet/lantiq_etop.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
drivers/net/ethernet/lantiq_etop.c +1 -5
@@ -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)
Signature · 1 line
2.46.2