commit 52686d9001703b67d734deec39d7cae9d5110765 Author: Jiri Slaby Date: Sun Jun 17 22:24:10 2007 +0200 ath/if_athvar.h cleanup diff --git a/ath/if_ath.c b/ath/if_ath.c index 0403417..ed6de19 100644 --- a/ath/if_ath.c +++ b/ath/if_ath.c @@ -102,11 +102,11 @@ enum { static int ath_init(struct net_device *); static int ath_reset(struct net_device *); -static void ath_fatal_tasklet(TQUEUE_ARG); -static void ath_bstuck_tasklet(TQUEUE_ARG); -static void ath_rxorn_tasklet(TQUEUE_ARG); -static void ath_bmiss_tasklet(TQUEUE_ARG); -static void ath_radar_tasklet(TQUEUE_ARG); +static void ath_fatal_tasklet(unsigned long); +static void ath_bstuck_tasklet(unsigned long); +static void ath_rxorn_tasklet(unsigned long); +static void ath_bmiss_tasklet(unsigned long); +static void ath_radar_tasklet(unsigned long); static int ath_stop_locked(struct net_device *); static int ath_stop(struct net_device *); #ifdef BLE @@ -146,7 +146,7 @@ static void ath_recv_mgmt(struct ieee80211com *, struct sk_buff *, int subtype, int rssi, u_int32_t rstamp); #endif static void ath_setdefantenna(struct ath_softc *, u_int); -static void ath_rx_tasklet(TQUEUE_ARG data); +static void ath_rx_tasklet(unsigned long data); static struct ath_txq *ath_txq_setup(struct ath_softc*, int qtype, int subtype); //static int ath_wme_update(struct ieee80211com *); static void ath_tx_cleanupq(struct ath_softc *, struct ath_txq *); @@ -156,9 +156,9 @@ static int ath_start(struct sk_buff *, struct net_device *); static int ath_tx_setup(struct ath_softc *, int ac, int txq); static int ath_tx_start(struct net_device *, struct ieee80211_node *, struct ath_buf *, struct sk_buff *); -static void ath_tx_tasklet_q0(TQUEUE_ARG data); -static void ath_tx_tasklet_q0123(TQUEUE_ARG data); -static void ath_tx_tasklet(TQUEUE_ARG data); +static void ath_tx_tasklet_q0(unsigned long data); +static void ath_tx_tasklet_q0123(unsigned long data); +static void ath_tx_tasklet(unsigned long data); static void ath_tx_timeout(struct net_device *); static int ath_chan_set(struct ath_softc *, struct ieee80211_channel *); #endif @@ -352,12 +352,12 @@ ath_attach(u_int16_t devid, struct net_device *dev) ATH_LOCK_INIT(sc); ATH_TXBUF_LOCK_INIT(sc); - ATH_INIT_TQUEUE(&sc->sc_rxtq, ath_rx_tasklet, dev); - ATH_INIT_TQUEUE(&sc->sc_rxorntq,ath_rxorn_tasklet, dev); - ATH_INIT_TQUEUE(&sc->sc_fataltq,ath_fatal_tasklet, dev); - ATH_INIT_TQUEUE(&sc->sc_bmisstq,ath_bmiss_tasklet, dev); - ATH_INIT_TQUEUE(&sc->sc_bstuckq,ath_bstuck_tasklet, dev); - ATH_INIT_TQUEUE(&sc->sc_radartq,ath_radar_tasklet, dev); + tasklet_init(&sc->sc_rxtq, ath_rx_tasklet, (unsigned long)dev); + tasklet_init(&sc->sc_rxorntq, ath_rxorn_tasklet, (unsigned long)dev); + tasklet_init(&sc->sc_fataltq, ath_fatal_tasklet, (unsigned long)dev); + tasklet_init(&sc->sc_bmisstq, ath_bmiss_tasklet, (unsigned long)dev); + tasklet_init(&sc->sc_bstuckq, ath_bstuck_tasklet, (unsigned long)dev); + tasklet_init(&sc->sc_radartq, ath_radar_tasklet, (unsigned long)dev); /* * Attach the hal @@ -821,12 +821,7 @@ ath_resume(struct net_device *dev) *Port r1752 - Starting linux kernel v2.6.19 and later *interrupt handlers are not passed. */ -irqreturn_t -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19) -ath_intr(int irq, void *dev_id) -#else -ath_intr(int irq, void *dev_id, struct pt_regs *regs) -#endif +irqreturn_t ath_intr(int irq, void *dev_id) { struct net_device *dev = dev_id; struct ath_softc *sc = dev->priv; @@ -872,11 +867,11 @@ ath_intr(int irq, void *dev_id, struct pt_regs *regs) */ sc->sc_stats.ast_hardware++; ath_hal_intrset(ah, 0); /* disable intr's until reset */ - ATH_SCHEDULE_TQUEUE(&sc->sc_fataltq, &needmark); + tasklet_schedule(&sc->sc_fataltq); } else if (status & AR5K_INT_RXORN) { sc->sc_stats.ast_rxorn++; ath_hal_intrset(ah, 0); /* disable intr's until reset */ - ATH_SCHEDULE_TQUEUE(&sc->sc_rxorntq, &needmark); + tasklet_schedule(&sc->sc_rxorntq); } else { if (status & AR5K_INT_SWBA) { /* @@ -902,12 +897,12 @@ ath_intr(int irq, void *dev_id, struct pt_regs *regs) ath_hal_updatetxtriglevel(ah, true); } if (status & AR5K_INT_RX) - ATH_SCHEDULE_TQUEUE(&sc->sc_rxtq, &needmark); + tasklet_schedule(&sc->sc_rxtq); if (status & AR5K_INT_TX) - ATH_SCHEDULE_TQUEUE(&sc->sc_txtq, &needmark); + tasklet_schedule(&sc->sc_txtq); if (status & AR5K_INT_BMISS) { sc->sc_stats.ast_bmiss++; - ATH_SCHEDULE_TQUEUE(&sc->sc_bmisstq, &needmark); + tasklet_schedule(&sc->sc_bmisstq); } if (status & AR5K_INT_MIB) { sc->sc_stats.ast_mib++; @@ -929,14 +924,11 @@ ath_intr(int irq, void *dev_id, struct pt_regs *regs) } } while (ath_hal_intrpend(ah)); - if (needmark) { - mark_bh(IMMEDIATE_BH); - } return IRQ_HANDLED; } static void -ath_fatal_tasklet(TQUEUE_ARG data) +ath_fatal_tasklet(unsigned long data) { struct net_device *dev = (struct net_device *)data; @@ -945,7 +937,7 @@ ath_fatal_tasklet(TQUEUE_ARG data) } static void -ath_radar_tasklet (TQUEUE_ARG data) +ath_radar_tasklet (unsigned long data) { struct net_device *dev = (struct net_device *)data; #ifdef BLE @@ -970,7 +962,7 @@ ath_radar_tasklet (TQUEUE_ARG data) } static void -ath_rxorn_tasklet(TQUEUE_ARG data) +ath_rxorn_tasklet(unsigned long data) { struct net_device *dev = (struct net_device *)data; @@ -979,7 +971,7 @@ ath_rxorn_tasklet(TQUEUE_ARG data) } static void -ath_bmiss_tasklet(TQUEUE_ARG data) +ath_bmiss_tasklet(unsigned long data) { #ifdef BLE struct net_device *dev = (struct net_device *)data; @@ -1630,14 +1622,15 @@ ath_start_raw(struct sk_buff *skb, struct net_device *dev) ath_hal_puttxbuf(ah, txq->axq_qnum, bf->bf_daddr); DPRINTF(sc, ATH_DEBUG_XMIT, "%s: TXDP[%u] = %llx (%p) depth %d\n", __func__, - txq->axq_qnum, ito64(bf->bf_daddr), bf->bf_desc, - txq->axq_depth); + txq->axq_qnum, (unsigned long long)bf->bf_daddr, + bf->bf_desc, txq->axq_depth); } else { *txq->axq_link = bf->bf_daddr; DPRINTF(sc, ATH_DEBUG_XMIT, "%s: link[%u](%p)=%llx (%p) depth %d\n", __func__, txq->axq_qnum, txq->axq_link, - ito64(bf->bf_daddr), bf->bf_desc, txq->axq_depth); + (unsigned long long)bf->bf_daddr, bf->bf_desc, + txq->axq_depth); } txq->axq_link = &bf->bf_desc->ds_link; /* @@ -2547,7 +2540,8 @@ ath_beacon_setup(struct ath_softc *sc, struct ath_buf *bf, skb->data, skb->len, BUS_DMA_TODEVICE); DPRINTF(sc, ATH_DEBUG_BEACON, "%s: skb %p [data %p len %u] skbaddr %llx\n", - __func__, skb, skb->data, skb->len, ito64(bf->bf_skbaddr)); + __func__, skb, skb->data, skb->len, + (unsigned long long)bf->bf_skbaddr); if (BUS_DMA_MAP_ERROR(bf->bf_skbaddr)) { printk(KERN_ERR "%s: DMA mapping failed\n", __func__); return; @@ -2652,7 +2646,7 @@ ath_beacon_send(struct net_device *dev) DPRINTF(sc, ATH_DEBUG_BEACON_PROC, "%s: stuck beacon time (%u missed)\n", __func__, sc->sc_bmisscount); - ATH_SCHEDULE_TQUEUE(&sc->sc_bstuckq, &needmark); + tasklet_schedule(&sc->sc_bstuckq); } return; } @@ -2750,7 +2744,7 @@ ath_beacon_send(struct net_device *dev) ath_hal_txstart(ah, sc->sc_bhalq); DPRINTF(sc, ATH_DEBUG_BEACON_PROC, "%s: TXDP[%u] = %llx (%p)\n", __func__, - sc->sc_bhalq, ito64(bf->bf_daddr), bf->bf_desc); + sc->sc_bhalq, (unsigned long long)bf->bf_daddr, bf->bf_desc); sc->sc_stats.ast_be_xmit++; } @@ -2759,7 +2753,7 @@ ath_beacon_send(struct net_device *dev) * Reset the hardware after detecting beacons have stopped. */ static void -ath_bstuck_tasklet(TQUEUE_ARG data) +ath_bstuck_tasklet(unsigned long data) { struct net_device *dev = (struct net_device *)data; struct ath_softc *sc = dev->priv; @@ -3043,7 +3037,8 @@ ath_desc_alloc(struct ath_softc *sc) } ds = sc->sc_desc; DPRINTF(sc, ATH_DEBUG_ANY, "%s: DMA map: %p (%u) -> %llx\n", - __func__, ds, (unsigned int) sc->sc_desc_len, ito64(sc->sc_desc_daddr)); + __func__, ds, (unsigned int) sc->sc_desc_len, + (unsigned long long)sc->sc_desc_daddr); /* allocate buffers */ bsize = sizeof(struct ath_buf) * (ATH_TXBUF + ATH_RXBUF + ATH_BCBUF + 1); @@ -3670,7 +3665,7 @@ ath_setdefantenna(struct ath_softc *sc, u_int antenna) } static void -ath_rx_tasklet(TQUEUE_ARG data) +ath_rx_tasklet(unsigned long data) { #define PA2DESC(_sc, _pa) \ ((struct ath_desc *)((caddr_t)(_sc)->sc_desc + \ @@ -3755,7 +3750,7 @@ ath_rx_tasklet(TQUEUE_ARG data) /* if (phyerr == AR5K_PHYERR_RADAR && ic->ic_opmode == IEEE80211_M_HOSTAP) { - ATH_SCHEDULE_TQUEUE (&sc->sc_radartq, &needmark); + tasklet_schedule(&sc->sc_radartq); } */ goto rx_next; @@ -4616,14 +4611,15 @@ ath_tx_start(struct net_device *dev, struct ieee80211_node *ni, struct ath_buf * ath_hal_puttxbuf(ah, txq->axq_qnum, bf->bf_daddr); DPRINTF(sc, ATH_DEBUG_XMIT, "%s: TXDP[%u] = %llx (%p) depth %d\n", __func__, - txq->axq_qnum, ito64(bf->bf_daddr), bf->bf_desc, - txq->axq_depth); + txq->axq_qnum, (unsigned long long)bf->bf_daddr, + bf->bf_desc, txq->axq_depth); } else { *txq->axq_link = bf->bf_daddr; DPRINTF(sc, ATH_DEBUG_XMIT, "%s: link[%u](%p)=%llx (%p) depth %d\n", __func__, txq->axq_qnum, txq->axq_link, - ito64(bf->bf_daddr), bf->bf_desc, txq->axq_depth); + (unsigned long long)bf->bf_daddr, bf->bf_desc, + txq->axq_depth); } txq->axq_link = &bf->bf_desc->ds_link; /* @@ -4752,7 +4748,7 @@ ath_tx_processq(struct ath_softc *sc, struct ath_txq *txq) * for a single hardware transmit queue (e.g. 5210 and 5211). */ static void -ath_tx_tasklet_q0(TQUEUE_ARG data) +ath_tx_tasklet_q0(unsigned long data) { struct net_device *dev = (struct net_device *)data; struct ath_softc *sc = dev->priv; @@ -4783,7 +4779,7 @@ ath_tx_tasklet_q0(TQUEUE_ARG data) * for four hardware queues, 0-3 (e.g. 5212 w/ WME support). */ static void -ath_tx_tasklet_q0123(TQUEUE_ARG data) +ath_tx_tasklet_q0123(unsigned long data) { struct net_device *dev = (struct net_device *)data; struct ath_softc *sc = dev->priv; @@ -4819,7 +4815,7 @@ ath_tx_tasklet_q0123(TQUEUE_ARG data) * Deferred processing of transmit interrupt. */ static void -ath_tx_tasklet(TQUEUE_ARG data) +ath_tx_tasklet(unsigned long data) { struct net_device *dev = (struct net_device *)data; struct ath_softc *sc = dev->priv; @@ -5739,7 +5735,7 @@ ath_printrxbuf(struct ath_buf *bf, int done) struct ath_desc *ds = bf->bf_desc; printk("R (%p %llx) %08x %08x %08x %08x %08x %08x %c\n", - ds, ito64(bf->bf_daddr), + ds, (unsigned long long)bf->bf_daddr, ds->ds_link, ds->ds_data, ds->ds_ctl0, ds->ds_ctl1, ds->ds_hw[0], ds->ds_hw[1], @@ -5752,7 +5748,7 @@ ath_printtxbuf(struct ath_buf *bf, int done) struct ath_desc *ds = bf->bf_desc; printk("T (%p %llx) %08x %08x %08x %08x %08x %08x %08x %08x %c\n", - ds, ito64(bf->bf_daddr), + ds, (unsigned long long)bf->bf_daddr, ds->ds_link, ds->ds_data, ds->ds_ctl0, ds->ds_ctl1, ds->ds_hw[0], ds->ds_hw[1], ds->ds_hw[2], ds->ds_hw[3], @@ -6257,7 +6253,8 @@ enum { }; static int -ATH_SYSCTL_DECL(ath_sysctl_halparam, ctl, write, filp, buffer, lenp, ppos) +ath_sysctl_halparam(ctl_table *ctl, int write, struct file *filp, + void __user *buffer, size_t *lenp, loff_t *ppos) { struct ath_softc *sc = ctl->extra1; struct ath_hal *ah = sc->sc_ah; @@ -6267,8 +6264,7 @@ ATH_SYSCTL_DECL(ath_sysctl_halparam, ctl, write, filp, buffer, lenp, ppos) ctl->data = &val; ctl->maxlen = sizeof(val); if (write) { - ret = ATH_SYSCTL_PROC_DOINTVEC(ctl, write, filp, buffer, - lenp, ppos); + ret = proc_dointvec(ctl, write, filp, buffer, lenp, ppos); if (ret == 0) { switch (ctl->ctl_name) { case ATH_SLOTTIME: @@ -6373,7 +6369,7 @@ ATH_SYSCTL_DECL(ath_sysctl_halparam, ctl, write, filp, buffer, lenp, ppos) ath_reset(&sc->sc_dev); break; case ATH_RADARSIM: - ATH_SCHEDULE_TQUEUE (&sc->sc_radartq, &needmark); + tasklet_schedule(&sc->sc_radartq); break; default: return -EINVAL; @@ -6456,8 +6452,7 @@ ATH_SYSCTL_DECL(ath_sysctl_halparam, ctl, write, filp, buffer, lenp, ppos) default: return -EINVAL; } - ret = ATH_SYSCTL_PROC_DOINTVEC(ctl, write, filp, buffer, - lenp, ppos); + ret = proc_dointvec(ctl, write, filp, buffer, lenp, ppos); } return ret; } diff --git a/ath/if_ath_pci.c b/ath/if_ath_pci.c index 439749e..c5a7d24 100644 --- a/ath/if_ath_pci.c +++ b/ath/if_ath_pci.c @@ -305,6 +305,9 @@ ath_pci_resume(struct pci_dev *pdev) return (0); } +#else +#define ath_pci_suspend NULL +#define ath_pci_resume NULL #endif /* CONFIG_PM */ MODULE_DEVICE_TABLE(pci, ath_pci_id_table); @@ -313,12 +316,9 @@ static struct pci_driver ath_pci_drv_id = { .name = "ath_pci", .id_table = ath_pci_id_table, .probe = ath_pci_probe, - .remove = ath_pci_remove, -#ifdef CONFIG_PM + .remove = __devexit_p(ath_pci_remove), .suspend = ath_pci_suspend, .resume = ath_pci_resume, -#endif /* CONFIG_PM */ - /* Linux 2.4.6 has save_state and enable_wake that are not used here */ }; /* diff --git a/ath/if_athvar.h b/ath/if_athvar.h index 7689ff5..cb707cd 100644 --- a/ath/if_athvar.h +++ b/ath/if_athvar.h @@ -42,83 +42,18 @@ #ifndef _DEV_ATH_ATHVAR_H #define _DEV_ATH_ATHVAR_H +#include +#include +#include + #include "ah.h" #include "if_athioctl.h" #include "if_athrate.h" -#include -#include - #ifndef ARPHRD_IEEE80211_RADIOTAP #define ARPHRD_IEEE80211_RADIOTAP 803 /* IEEE 802.11 + radiotap header */ #endif /* ARPHRD_IEEE80211_RADIOTAP */ -/* - * Deduce if tasklets are available. If not then - * fall back to using the immediate work queue. - */ -#include -#ifdef DECLARE_TASKLET /* native tasklets */ -#define tq_struct tasklet_struct -#define ATH_INIT_TQUEUE(a,b,c) tasklet_init((a),(b),(unsigned long)(c)) -#define ATH_SCHEDULE_TQUEUE(a,b) tasklet_schedule((a)) -typedef unsigned long TQUEUE_ARG; -#define mark_bh(a) -#else /* immediate work queue */ -#define ATH_INIT_TQUEUE(a,b,c) INIT_TQUEUE(a,b,c) -#define ATH_SCHEDULE_TQUEUE(a,b) do { \ - *(b) |= queue_task((a), &tq_immediate); \ -} while(0) -typedef void *TQUEUE_ARG; -#define tasklet_disable(t) do { (void) t; local_bh_disable(); } while (0) -#define tasklet_enable(t) do { (void) t; local_bh_enable(); } while (0) -#endif /* !DECLARE_TASKLET */ - -/* - * Guess how the interrupt handler should work. - */ -#if !defined(IRQ_NONE) -typedef void irqreturn_t; -#define IRQ_NONE -#define IRQ_HANDLED -#endif /* !defined(IRQ_NONE) */ - -#ifndef SET_MODULE_OWNER -#define SET_MODULE_OWNER(dev) do { \ - dev->owner = THIS_MODULE; \ -} while (0) -#endif - -#ifndef SET_NETDEV_DEV -#define SET_NETDEV_DEV(ndev, pdev) -#endif - - -/* - * Macro to expand scalars to 64-bit objects - */ -#define ito64(x) (sizeof(x)==8) ? (((unsigned long long int)(x)) & (0xff)) : \ - (sizeof(x)==16) ? (((unsigned long long int)(x)) & 0xffff) : \ - ((sizeof(x)==32) ? (((unsigned long long int)(x)) & 0xffffffff): (unsigned long long int)(x)) - - -/* - * Deal with the sysctl handler api changing. - */ -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,8) -#define ATH_SYSCTL_DECL(f, ctl, write, filp, buffer, lenp, ppos) \ - f(ctl_table *ctl, int write, struct file *filp, void *buffer, \ - size_t *lenp) -#define ATH_SYSCTL_PROC_DOINTVEC(ctl, write, filp, buffer, lenp, ppos) \ - proc_dointvec(ctl, write, filp, buffer, lenp) -#else /* LINUX_VERSION_CODE < KERNEL_VERSION(2,6,8) */ -#define ATH_SYSCTL_DECL(f, ctl, write, filp, buffer, lenp, ppos) \ - f(ctl_table *ctl, int write, struct file *filp, void __user *buffer,\ - size_t *lenp, loff_t *ppos) -#define ATH_SYSCTL_PROC_DOINTVEC(ctl, write, filp, buffer, lenp, ppos) \ - proc_dointvec(ctl, write, filp, buffer, lenp, ppos) -#endif - #define ATH_TIMEOUT 1000 /* @@ -331,14 +266,14 @@ struct ath_softc { } u_rx_rt; int sc_rx_th_len; - struct tq_struct sc_fataltq; /* fatal int tasklet */ - struct tq_struct sc_radartq; /* Radar detection */ + struct tasklet_struct sc_fataltq; /* fatal int tasklet */ + struct tasklet_struct sc_radartq; /* Radar detection */ int sc_rxbufsize; /* rx size based on mtu */ struct list_head *sc_rxbuf; /* receive buffer */ u32 *sc_rxlink; /* link ptr in last RX desc */ - struct tq_struct sc_rxtq; /* rx intr tasklet */ - struct tq_struct sc_rxorntq; /* rxorn intr tasklet */ + struct tasklet_struct sc_rxtq; /* rx intr tasklet */ + struct tasklet_struct sc_rxorntq; /* rxorn intr tasklet */ u8 sc_defant; /* current default antenna */ u8 sc_rxotherant; /* rx's on non-default antenna*/ @@ -349,7 +284,7 @@ struct ath_softc { u_int sc_txintrperiod;/* tx interrupt batching */ struct ath_txq sc_txq[AR5K_NUM_TX_QUEUES]; struct ath_txq *sc_ac2q[5]; /* WME AC -> h/w q map */ - struct tq_struct sc_txtq; /* tx intr tasklet */ + struct tasklet_struct sc_txtq; /* tx intr tasklet */ struct list_head *sc_bbuf; /* beacon buffers */ u_int sc_bhalq; /* HAL q for outgoing beacons */ @@ -360,8 +295,8 @@ struct ath_softc { #ifdef BLE struct ieee80211_beacon_offsets sc_boff;/* dynamic update state */ #endif - struct tq_struct sc_bmisstq; /* bmiss intr tasklet */ - struct tq_struct sc_bstuckq; /* stuck beacon processing */ + struct tasklet_struct sc_bmisstq; /* bmiss intr tasklet */ + struct tasklet_struct sc_bstuckq; /* stuck beacon processing */ enum { OK, /* no change needed */ UPDATE, /* update pending */ @@ -402,11 +337,7 @@ void ath_suspend(struct net_device *); *Port r1752 - Starting linux kernel v2.6.19 and later *interrupt handlers are not passed. */ -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,19) irqreturn_t ath_intr(int, void *); -#else -irqreturn_t ath_intr(int, void *, struct pt_regs *regs); -#endif void bus_read_cachesize(struct ath_softc *, u8 *); int ath_ioctl_ethtool(struct ath_softc *, int, void __user *); void ath_sysctl_register(void);