From 91bc5a3b57a1febc6bcfc2d075ec4c310f384996 Mon Sep 17 00:00:00 2001 From: Russ Meyerriecks Date: Thu, 7 Aug 2014 16:20:19 -0500 Subject: [PATCH] net: Update dahdi for alloc_netdev() api change in 3.17+ https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=c835a677331495cf137a7f8a023463afd9f0~ Signed-off-by: Russ Meyerriecks Acked-by: Shaun Ruffell --- drivers/dahdi/datamods/hdlc_fr.c | 15 +++++++++++++-- drivers/dahdi/datamods/hdlc_generic.c | 5 +++++ drivers/dahdi/voicebus/voicebus_net.c | 6 ++++++ drivers/dahdi/wctc4xxp/base.c | 6 ++++++ 4 files changed, 30 insertions(+), 2 deletions(-) diff --git a/drivers/dahdi/datamods/hdlc_fr.c b/drivers/dahdi/datamods/hdlc_fr.c index 523afe1..073bb90 100644 --- a/drivers/dahdi/datamods/hdlc_fr.c +++ b/drivers/dahdi/datamods/hdlc_fr.c @@ -1063,12 +1063,23 @@ static int fr_add_pvc(struct net_device *master, unsigned int dlci, int type) used = pvc_is_used(pvc); - if (type == ARPHRD_ETHER) + if (type == ARPHRD_ETHER) { +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 17, 0) + dev = alloc_netdev(sizeof(struct net_device_stats), + "pvceth%d", NET_NAME_UNKNOWN, ether_setup); +#else dev = alloc_netdev(sizeof(struct net_device_stats), "pvceth%d", ether_setup); - else +#endif + } else { +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 17, 0) + dev = alloc_netdev(sizeof(struct net_device_stats), + "pvc%d", NET_NAME_UNKNOWN, dlci_setup); +#else dev = alloc_netdev(sizeof(struct net_device_stats), "pvc%d", dlci_setup); +#endif + } if (!dev) { printk(KERN_WARNING "%s: Memory squeeze on fr_pvc()\n", diff --git a/drivers/dahdi/datamods/hdlc_generic.c b/drivers/dahdi/datamods/hdlc_generic.c index 46cef8f..f5596c4 100644 --- a/drivers/dahdi/datamods/hdlc_generic.c +++ b/drivers/dahdi/datamods/hdlc_generic.c @@ -282,7 +282,12 @@ static void hdlc_setup(struct net_device *dev) struct net_device *alloc_hdlcdev(void *priv) { struct net_device *dev; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 17, 0) + dev = alloc_netdev(sizeof(hdlc_device), "hdlc%d", + NET_NAME_UNKNOWN, hdlc_setup); +#else dev = alloc_netdev(sizeof(hdlc_device), "hdlc%d", hdlc_setup); +#endif if (dev) dev_to_hdlc(dev)->priv = priv; return dev; diff --git a/drivers/dahdi/voicebus/voicebus_net.c b/drivers/dahdi/voicebus/voicebus_net.c index c90bb2a..27475a5 100644 --- a/drivers/dahdi/voicebus/voicebus_net.c +++ b/drivers/dahdi/voicebus/voicebus_net.c @@ -207,7 +207,13 @@ int vb_net_register(struct voicebus *vb, const char *board_name) struct voicebus_netdev_priv *priv; const char our_mac[] = { 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff}; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 17, 0) + netdev = alloc_netdev(sizeof(*priv), board_name, + NET_NAME_UNKNOWN, ether_setup); +#else netdev = alloc_netdev(sizeof(*priv), board_name, ether_setup); +#endif + if (!netdev) return -ENOMEM; priv = netdev_priv(netdev); diff --git a/drivers/dahdi/wctc4xxp/base.c b/drivers/dahdi/wctc4xxp/base.c index e04609e..d1e1507 100644 --- a/drivers/dahdi/wctc4xxp/base.c +++ b/drivers/dahdi/wctc4xxp/base.c @@ -657,7 +657,13 @@ wctc4xxp_net_register(struct wcdte *wc) struct wcdte_netdev_priv *priv; const char our_mac[] = { 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff}; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 17, 0) + netdev = alloc_netdev(sizeof(*priv), wc->board_name, + NET_NAME_UNKNOWN, ether_setup); +#else netdev = alloc_netdev(sizeof(*priv), wc->board_name, ether_setup); +#endif + if (!netdev) return -ENOMEM; priv = netdev_priv(netdev);