From: Pavel Roskin Date: Mon, 4 Aug 2014 19:16:13 +0000 (-0400) Subject: Use Linux 3.17 4-argument alloc_netdev(), provide compatibility code X-Git-Url: http://git.ozo.com/?a=commitdiff_plain;h=c5246021b7b8580c2aeb0a145903acc07d246ac1;p=madwifi%2F.git Use Linux 3.17 4-argument alloc_netdev(), provide compatibility code --- diff --git a/ath/if_ath_ahb.c b/ath/if_ath_ahb.c index 7fa185d..59c6579 100644 --- a/ath/if_ath_ahb.c +++ b/ath/if_ath_ahb.c @@ -188,7 +188,8 @@ init_ath_wmac(u_int16_t devid, u_int16_t wlanNum, struct ar531x_config *config) ahb_enable_wmac(devid, wlanNum); - dev = alloc_netdev(sizeof(struct ath_softc), "wifi%d", ether_setup); + dev = alloc_netdev(sizeof(struct ath_softc), "wifi%d", NET_NAME_UNKNOWN, + ether_setup); if (dev == NULL) { printk(KERN_ERR "%s: no memory for device state\n", dev_info); goto bad2; diff --git a/ath/if_ath_pci.c b/ath/if_ath_pci.c index 6451f66..1f5b960 100644 --- a/ath/if_ath_pci.c +++ b/ath/if_ath_pci.c @@ -184,7 +184,8 @@ ath_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) goto bad1; } - dev = alloc_netdev(sizeof(struct ath_softc), "wifi%d", ether_setup); + dev = alloc_netdev(sizeof(struct ath_softc), "wifi%d", NET_NAME_UNKNOWN, + ether_setup); if (dev == NULL) { printk(KERN_ERR "%s: no memory for device state\n", dev_info); goto bad2; diff --git a/include/compat.h b/include/compat.h index db9d98f..6348d79 100644 --- a/include/compat.h +++ b/include/compat.h @@ -93,6 +93,20 @@ #define ath_ha_addr(ha) ha->addr #endif +#ifndef NET_NAME_UNKNOWN +#undef alloc_netdev +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23) +#define alloc_netdev(sizeof_priv, name, name_assign_type, setup) \ + alloc_netdev(sizeof_priv, name, setup) +#elif 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 +#endif + /* * BSD/Linux compatibility shims. These are used mainly to * minimize differences when importing necessary BSD code.