Subject: linux-next: build failure after merge of the net-next tree

From: Stephen Rothwell <[email-masked]>
Date: Tue, 29 Sep 2020 13:04:46 +1000

Hi all,

After merging the net-next tree, today's linux-next build (x86_64
allmodconfig) failed like this:

drivers/net/ethernet/marvell/prestera/prestera_main.c: In function 'prestera_port_dev_lower_find':
drivers/net/ethernet/marvell/prestera/prestera_main.c:504:33: error: passing argument 2 of 'netdev_walk_all_lower_dev' from incompatible pointer type [-Werror=incompatible-pointer-types]
  504 |  netdev_walk_all_lower_dev(dev, prestera_lower_dev_walk, &port);
      |                                 ^~~~~~~~~~~~~~~~~~~~~~~
      |                                 |
      |                                 int (*)(struct net_device *, void *)
In file included from include/linux/etherdevice.h:21,
                 from drivers/net/ethernet/marvell/prestera/prestera_main.c:4:
include/linux/netdevice.h:4571:16: note: expected 'int (*)(struct net_device *, struct netdev_nested_priv *)' but argument is of type 'int (*)(struct net_device *, void *)'
 4571 |          int (*fn)(struct net_device *lower_dev,
      |          ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 4572 |      struct netdev_nested_priv *priv),
      |      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/net/ethernet/marvell/prestera/prestera_main.c:504:58: error: passing argument 3 of 'netdev_walk_all_lower_dev' from incompatible pointer type [-Werror=incompatible-pointer-types]
  504 |  netdev_walk_all_lower_dev(dev, prestera_lower_dev_walk, &port);
      |                                                          ^~~~~
      |                                                          |
      |                                                          struct prestera_port **
In file included from include/linux/etherdevice.h:21,
                 from drivers/net/ethernet/marvell/prestera/prestera_main.c:4:
include/linux/netdevice.h:4573:37: note: expected 'struct netdev_nested_priv *' but argument is of type 'struct prestera_port **'
 4573 |          struct netdev_nested_priv *priv);
      |          ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
cc1: some warnings being treated as errors

Caused by commit

  eff7423365a6 ("net: core: introduce struct netdev_nested_priv for nested interface infrastructure")

interacting with commit

  e1189d9a5fbe ("net: marvell: prestera: Add Switchdev driver implementation")

also in the net-next tree.

I applied the following fix patch.

From: Stephen Rothwell <[email-masked]>
Date: Tue, 29 Sep 2020 12:57:59 +1000
Subject: [PATCH] fix up for "net: core: introduce struct netdev_nested_priv for nested interface infrastructure"

Signed-off-by: Stephen Rothwell <[email-masked]>
---
 drivers/net/ethernet/marvell/prestera/prestera_main.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/marvell/prestera/prestera_main.c b/drivers/net/ethernet/marvell/prestera/prestera_main.c
index 9bd57b89d1d0..633d8770be35 100644
--- a/drivers/net/ethernet/marvell/prestera/prestera_main.c
+++ b/drivers/net/ethernet/marvell/prestera/prestera_main.c
@@ -482,9 +482,10 @@ bool prestera_netdev_check(const struct net_device *dev)
 	return dev->netdev_ops == &prestera_netdev_ops;
 }
 
-static int prestera_lower_dev_walk(struct net_device *dev, void *data)
+static int prestera_lower_dev_walk(struct net_device *dev,
+				   struct netdev_nested_priv *priv)
 {
-	struct prestera_port **pport = data;
+	struct prestera_port **pport = (struct prestera_port **)priv->data;
 
 	if (prestera_netdev_check(dev)) {
 		*pport = netdev_priv(dev);
@@ -497,11 +498,13 @@ static int prestera_lower_dev_walk(struct net_device *dev, void *data)
 struct prestera_port *prestera_port_dev_lower_find(struct net_device *dev)
 {
 	struct prestera_port *port = NULL;
+	struct netdev_nested_priv priv;
 
 	if (prestera_netdev_check(dev))
 		return netdev_priv(dev);
 
-	netdev_walk_all_lower_dev(dev, prestera_lower_dev_walk, &port);
+	priv.data = (void *)&port;
+	netdev_walk_all_lower_dev(dev, prestera_lower_dev_walk, &priv);
 
 	return port;
 }
-- 
2.28.0

-- 
Cheers,
Stephen Rothwell