Use Linux 3.17 4-argument alloc_netdev(), provide compatibility code

This commit is contained in:
Pavel Roskin 2014-08-04 15:16:13 -04:00
parent e1a1d8f94f
commit c5246021b7
3 changed files with 18 additions and 2 deletions

View File

@ -188,7 +188,8 @@ init_ath_wmac(u_int16_t devid, u_int16_t wlanNum, struct ar531x_config *config)
ahb_enable_wmac(devid, wlanNum); 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) { if (dev == NULL) {
printk(KERN_ERR "%s: no memory for device state\n", dev_info); printk(KERN_ERR "%s: no memory for device state\n", dev_info);
goto bad2; goto bad2;

View File

@ -184,7 +184,8 @@ ath_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
goto bad1; 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) { if (dev == NULL) {
printk(KERN_ERR "%s: no memory for device state\n", dev_info); printk(KERN_ERR "%s: no memory for device state\n", dev_info);
goto bad2; goto bad2;

View File

@ -93,6 +93,20 @@
#define ath_ha_addr(ha) ha->addr #define ath_ha_addr(ha) ha->addr
#endif #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 * BSD/Linux compatibility shims. These are used mainly to
* minimize differences when importing necessary BSD code. * minimize differences when importing necessary BSD code.