Repository : ssh://git@open-mesh.org/batman-adv
On branch : next
commit df768d79b9b2e5730e7474e7146af08434709574 Author: Tom Gundersen teg@jklm.no Date: Mon Jul 21 15:42:05 2014 +0200
net: set name_assign_type in alloc_netdev()
Extend alloc_netdev{,_mq{,s}}() to take name_assign_type as argument, and convert all users to pass NET_NAME_UNKNOWN.
Coccinelle patch:
@@ expression sizeof_priv, name, setup, txqs, rxqs, count; @@
( -alloc_netdev_mqs(sizeof_priv, name, setup, txqs, rxqs) +alloc_netdev_mqs(sizeof_priv, name, NET_NAME_UNKNOWN, setup, txqs, rxqs) | -alloc_netdev_mq(sizeof_priv, name, setup, count) +alloc_netdev_mq(sizeof_priv, name, NET_NAME_UNKNOWN, setup, count) | -alloc_netdev(sizeof_priv, name, setup) +alloc_netdev(sizeof_priv, name, NET_NAME_UNKNOWN, setup) )
v9: move comments here from the wrong commit
Signed-off-by: Tom Gundersen teg@jklm.no Reviewed-by: David Herrmann dh.herrmann@gmail.com Signed-off-by: David S. Miller davem@davemloft.net [sw: added compat code] Signed-off-by: Simon Wunderlich sw@simonwunderlich.de Signed-off-by: Marek Lindner mareklindner@neomailbox.ch
df768d79b9b2e5730e7474e7146af08434709574 compat.h | 10 ++++++++++ soft-interface.c | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/compat.h b/compat.h index acf903e..d3db201 100644 --- a/compat.h +++ b/compat.h @@ -452,6 +452,16 @@ static int __batadv_interface_kill_vid(struct net_device *dev, __be16 proto,\
#define hlist_add_behind(n, prev) hlist_add_after(prev, n)
+/* alloc_netdev() was defined differently before 2.6.38 */ +#undef alloc_netdev +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 38) +#define alloc_netdev(sizeof_priv, name, name_assign_type, setup) \ + alloc_netdev_mq(sizeof_priv, name, setup, 1) +#else +#define alloc_netdev(sizeof_priv, name, name_assign_type, setup) \ + alloc_netdev_mqs(sizeof_priv, name, setup, 1, 1) +#endif /* nested < KERNEL_VERSION(2, 6, 38) */ + #endif /* < KERNEL_VERSION(3, 17, 0) */
#endif /* _NET_BATMAN_ADV_COMPAT_H_ */ diff --git a/soft-interface.c b/soft-interface.c index 9bf382d..cfc2cd2 100644 --- a/soft-interface.c +++ b/soft-interface.c @@ -933,7 +933,7 @@ struct net_device *batadv_softif_create(const char *name) int ret;
soft_iface = alloc_netdev(sizeof(struct batadv_priv), name, - batadv_softif_init_early); + NET_NAME_UNKNOWN, batadv_softif_init_early); if (!soft_iface) return NULL;