diff --git a/ath/if_ath.c b/ath/if_ath.c index 9773e01..f4271d3 100644 --- a/ath/if_ath.c +++ b/ath/if_ath.c @@ -526,7 +526,8 @@ ath_attach(u_int16_t devid, struct net_device *dev, HAL_BUS_TAG tag) /* Allocate space for dynamically determined maximum VAP count */ sc->sc_bslot = - kzalloc(ath_maxvaps * sizeof(struct ieee80211vap), GFP_KERNEL); + kmalloc(ath_maxvaps * sizeof(struct ieee80211vap), GFP_KERNEL); + memset(sc->sc_bslot, 0, ath_maxvaps * sizeof(struct ieee80211vap)); /* * Cache line size is used to size and align various @@ -1345,7 +1346,11 @@ ath_vap_create(struct ieee80211com *ic, const char *name, } } avp->av_bslot = -1; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,15) atomic_set(&avp->av_beacon_alloc, 0); +#else + clear_bit(0, &avp->av_beacon_alloc); +#endif STAILQ_INIT(&avp->av_mcastq.axq_q); ATH_TXQ_LOCK_INIT(&avp->av_mcastq); if (IEEE80211_IS_MODE_BEACON(opmode)) { @@ -4509,7 +4514,11 @@ ath_beacon_alloc(struct ath_softc *sc, struct ieee80211_node *ni) { struct ath_vap * avp = ATH_VAP(ni->ni_vap); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,15) atomic_set(&avp->av_beacon_alloc, 1); +#else + set_bit(0, &avp->av_beacon_alloc); +#endif return 0; } @@ -4754,9 +4763,12 @@ ath_beacon_generate(struct ath_softc *sc, struct ieee80211vap *vap, int *needmar } #endif - if (atomic_add_unless(&avp->av_beacon_alloc, -1, 0)) { - ath_beacon_alloc_internal(sc, vap->iv_bss); - } +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,15) + if (atomic_add_unless(&avp->av_beacon_alloc, -1, 0)) +#else + if (test_and_clear_bit(0, &avp->av_beacon_alloc)) +#endif + ath_beacon_alloc_internal(sc, vap->iv_bss); /* * Update dynamic beacon contents. If this returns diff --git a/ath/if_ath_radar.c b/ath/if_ath_radar.c index 8ce59d5..5198123 100644 --- a/ath/if_ath_radar.c +++ b/ath/if_ath_radar.c @@ -1532,9 +1532,11 @@ void ath_rp_init(struct ath_softc *sc) ath_rp_clear(sc); - sc->sc_rp = (struct ath_rp *)kzalloc( - sizeof(struct ath_rp) * + sc->sc_rp = (struct ath_rp *)kmalloc( + sizeof(struct ath_rp) * ATH_RADAR_PULSE_NR, GFP_KERNEL); + memset(sc->sc_rp, 0, sizeof(struct ath_rp) * + ATH_RADAR_PULSE_NR); if (sc->sc_rp == NULL) return; diff --git a/ath/if_athvar.h b/ath/if_athvar.h index 547b06d..c83c6ce 100644 --- a/ath/if_athvar.h +++ b/ath/if_athvar.h @@ -49,6 +49,9 @@ #include "net80211/ieee80211.h" /* XXX for WME_NUM_AC */ #include #include +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,15) +# include +#endif /* * Deduce if tasklets are available. If not then @@ -123,11 +126,6 @@ typedef void irqreturn_t; #define ATH_GET_NETDEV_DEV(ndev) ((ndev)->class_dev.dev) #endif -#ifndef NETDEV_TX_OK -#define NETDEV_TX_OK 0 -#define NETDEV_TX_BUSY 1 -#endif - #if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,23) static inline struct net_device *_alloc_netdev(int sizeof_priv, const char *mask, void (*setup)(struct net_device *)) @@ -520,8 +518,12 @@ struct ath_vap { struct ieee80211_beacon_offsets av_boff;/* dynamic update state */ int av_bslot; /* beacon slot index */ struct ath_txq av_mcastq; /* multicast transmit queue */ +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,15) atomic_t av_beacon_alloc; /* set to 1 when the next beacon needs to be recomputed */ +#else + unsigned int av_beacon_alloc; +#endif }; #define ATH_VAP(_v) ((struct ath_vap *)(_v)) diff --git a/include/compat.h b/include/compat.h index 608f846..37af1df 100644 --- a/include/compat.h +++ b/include/compat.h @@ -42,7 +42,9 @@ #ifdef __KERNEL__ #include #include +#include #endif + #if !defined(__KERNEL__) || !defined (__bitwise) #define __le16 u_int16_t #define __le32 u_int32_t @@ -54,11 +56,23 @@ #endif #ifndef container_of -#define container_of(ptr, type, member) ({ \ +#define container_of(ptr, type, member) ({ \ const typeof( ((type *)0)->member ) *__mptr = (ptr); \ (type *)( (char *)__mptr - offsetof(type,member) );}) #endif +#ifndef list_for_each_entry_reverse +#define list_for_each_entry_reverse(pos, head, member) \ + for (pos = list_entry((head)->prev, typeof(*pos), member); \ + prefetch(pos->member.prev), &pos->member != (head); \ + pos = list_entry(pos->member.prev, typeof(*pos), member)) +#endif + +#ifndef NETDEV_TX_OK +#define NETDEV_TX_OK 0 +#define NETDEV_TX_BUSY 1 +#endif + /* * BSD/Linux compatibility shims. These are used mainly to * minimize differences when importing necesary BSD code. diff --git a/net80211/ieee80211_power.c b/net80211/ieee80211_power.c index e5d3327..7a97b4b 100644 --- a/net80211/ieee80211_power.c +++ b/net80211/ieee80211_power.c @@ -52,11 +52,6 @@ #include #include -#ifndef NETDEV_TX_OK -#define NETDEV_TX_OK 0 -#define NETDEV_TX_BUSY 1 -#endif - static void ieee80211_set_tim(struct ieee80211_node *ni, int set); void diff --git a/net80211/ieee80211_scan_ap.c b/net80211/ieee80211_scan_ap.c index ebd1190..9a0e6da 100644 --- a/net80211/ieee80211_scan_ap.c +++ b/net80211/ieee80211_scan_ap.c @@ -46,7 +46,12 @@ #include #include #include + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,11) +#include "sort.c" +#else #include +#endif #include "if_media.h"