1 Convert to net_device_ops for Linux 2.6.29+
2 http://madwifi-project.org/changeset/4005
5 @@ -566,6 +566,20 @@ static inline int rate_factor(int mode)
7 /* Initialize ath_softc structure */
9 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29)
10 +static const struct net_device_ops ath_netdev_ops = {
11 + .ndo_open = ath_init,
12 + .ndo_stop = ath_stop,
13 + .ndo_start_xmit = ath_hardstart,
14 + .ndo_tx_timeout = ath_tx_timeout,
15 + .ndo_set_multicast_list = ath_mode_init,
16 + .ndo_do_ioctl = ath_ioctl,
17 + .ndo_get_stats = ath_getstats,
18 + .ndo_set_mac_address = ath_set_mac_address,
19 + .ndo_change_mtu = ath_change_mtu,
24 ath_attach(u_int16_t devid, struct net_device *dev, HAL_BUS_TAG tag)
26 @@ -865,16 +879,20 @@ ath_attach(u_int16_t devid, struct net_d
29 /* NB: ether_setup is done by bus-specific code */
30 +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29)
33 dev->hard_start_xmit = ath_hardstart;
34 dev->tx_timeout = ath_tx_timeout;
35 - dev->watchdog_timeo = 5 * HZ;
36 dev->set_multicast_list = ath_mode_init;
37 dev->do_ioctl = ath_ioctl;
38 dev->get_stats = ath_getstats;
39 dev->set_mac_address = ath_set_mac_address;
40 dev->change_mtu = ath_change_mtu;
42 + dev->netdev_ops = &ath_netdev_ops;
44 + dev->watchdog_timeo = 5 * HZ;
45 dev->tx_queue_len = ATH_TXBUF - ATH_TXBUF_MGT_RESERVED;
46 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)
47 netif_napi_add(dev, &sc->sc_napi, ath_rx_poll, 64);
48 @@ -12726,8 +12744,13 @@ ath_rcv_dev_event(struct notifier_block
49 struct net_device *dev = (struct net_device *)ptr;
50 struct ath_softc *sc = (struct ath_softc *)netdev_priv(dev);
52 +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29)
53 if (!dev || !sc || dev->open != &ath_init)
56 + if (!dev || !sc || dev->netdev_ops->ndo_open != &ath_init)
61 case NETDEV_CHANGENAME:
62 --- a/net80211/ieee80211.c
63 +++ b/net80211/ieee80211.c
64 @@ -450,6 +450,17 @@ ieee80211_ifdetach(struct ieee80211com *
66 EXPORT_SYMBOL(ieee80211_ifdetach);
68 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29)
69 +static const struct net_device_ops ieee80211_netdev_ops = {
70 + .ndo_get_stats = ieee80211_getstats,
71 + .ndo_open = ieee80211_open,
72 + .ndo_stop = ieee80211_stop,
73 + .ndo_start_xmit = ieee80211_hardstart,
74 + .ndo_set_multicast_list = ieee80211_set_multicast_list,
75 + .ndo_change_mtu = ieee80211_change_mtu,
80 ieee80211_vap_setup(struct ieee80211com *ic, struct net_device *dev,
81 const char *name, int opmode, int flags, struct ieee80211vap *master)
82 @@ -470,12 +481,16 @@ ieee80211_vap_setup(struct ieee80211com
84 strncpy(dev->name, name, sizeof(dev->name));
86 +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29)
88 dev->get_stats = ieee80211_getstats;
89 dev->open = ieee80211_open;
90 dev->stop = ieee80211_stop;
91 dev->hard_start_xmit = ieee80211_hardstart;
92 dev->set_multicast_list = ieee80211_set_multicast_list;
94 + dev->netdev_ops = &ieee80211_netdev_ops;
97 dev->set_mac_address = ieee80211_set_mac_address;
99 @@ -1823,7 +1838,11 @@ ieee80211_set_multicast_list(struct net_
100 IEEE80211_UNLOCK_IRQ(ic);
102 /* XXX: Merge multicast list into parent device */
103 +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29)
104 parent->set_multicast_list(ic->ic_dev);
106 + parent->netdev_ops->ndo_set_multicast_list(ic->ic_dev);
111 --- a/net80211/ieee80211_linux.c
112 +++ b/net80211/ieee80211_linux.c
113 @@ -984,8 +984,14 @@ ieee80211_rcv_dev_event(struct notifier_
116 struct net_device *dev = (struct net_device *) ptr;
118 +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29)
119 if (!dev || dev->open != &ieee80211_open)
122 + if (!dev || dev->netdev_ops->ndo_open != &ieee80211_open)
127 case NETDEV_CHANGENAME: