ath5k: Fix build warnings on some 64-bit platforms.
[safe/jmp/linux-2.6] / drivers / net / wireless / ath5k / base.c
index b2a6ef5..bef967c 100644 (file)
@@ -153,7 +153,7 @@ static int          ath5k_pci_resume(struct pci_dev *pdev);
 #define ath5k_pci_resume NULL
 #endif /* CONFIG_PM */
 
-static struct pci_driver ath5k_pci_drv_id = {
+static struct pci_driver ath5k_pci_driver = {
        .name           = "ath5k_pci",
        .id_table       = ath5k_pci_id_table,
        .probe          = ath5k_pci_probe,
@@ -329,7 +329,7 @@ init_ath5k_pci(void)
 
        ath5k_debug_init();
 
-       ret = pci_register_driver(&ath5k_pci_drv_id);
+       ret = pci_register_driver(&ath5k_pci_driver);
        if (ret) {
                printk(KERN_ERR "ath5k_pci: can't register pci driver\n");
                return ret;
@@ -341,7 +341,7 @@ init_ath5k_pci(void)
 static void __exit
 exit_ath5k_pci(void)
 {
-       pci_unregister_driver(&ath5k_pci_drv_id);
+       pci_unregister_driver(&ath5k_pci_driver);
 
        ath5k_debug_finish();
 }
@@ -668,7 +668,10 @@ ath5k_attach(struct pci_dev *pdev, struct ieee80211_hw *hw)
         * return false w/o doing anything.  MAC's that do
         * support it will return true w/o doing anything.
         */
-       if (ah->ah_setup_xtx_desc(ah, NULL, 0, 0, 0, 0, 0, 0))
+       ret = ah->ah_setup_xtx_desc(ah, NULL, 0, 0, 0, 0, 0, 0);
+       if (ret < 0)
+               goto err;
+       if (ret > 0)
                __set_bit(ATH_STAT_MRRETRY, sc->status);
 
        /*
@@ -1256,7 +1259,7 @@ ath5k_txbuf_setup(struct ath5k_softc *sc, struct ath5k_buf *bf,
        if (ctl->flags & IEEE80211_TXCTL_NO_ACK)
                flags |= AR5K_TXDESC_NOACK;
 
-       pktlen = skb->len + FCS_LEN;
+       pktlen = skb->len;
 
        if (!(ctl->flags & IEEE80211_TXCTL_DO_NOT_ENCRYPT)) {
                keyidx = ctl->key_idx;
@@ -1715,6 +1718,7 @@ ath5k_tasklet_rx(unsigned long data)
                        break;
                else if (unlikely(ret)) {
                        ATH5K_ERR(sc, "error in processing rx descriptor\n");
+                       spin_unlock(&sc->rxbuflock);
                        return;
                }
 
@@ -1775,11 +1779,18 @@ accept:
                        skb_pull(skb, pad);
                }
 
-               if (sc->opmode == IEEE80211_IF_TYPE_MNTR)
-                       rxs.mactime = ath5k_extend_tsf(sc->ah,
-                                       ds->ds_rxstat.rs_tstamp);
-               else
-                       rxs.mactime = ds->ds_rxstat.rs_tstamp;
+               /*
+                * always extend the mac timestamp, since this information is
+                * also needed for proper IBSS merging.
+                *
+                * XXX: it might be too late to do it here, since rs_tstamp is
+                * 15bit only. that means TSF extension has to be done within
+                * 32768usec (about 32ms). it might be necessary to move this to
+                * the interrupt handler, like it is done in madwifi.
+                */
+               rxs.mactime = ath5k_extend_tsf(sc->ah, ds->ds_rxstat.rs_tstamp);
+               rxs.flag |= RX_FLAG_TSFT;
+
                rxs.freq = sc->curchan->freq;
                rxs.channel = sc->curchan->chan;
                rxs.phymode = sc->curmode;
@@ -1945,7 +1956,7 @@ ath5k_beacon_setup(struct ath5k_softc *sc, struct ath5k_buf *bf,
        }
 
        ds->ds_data = bf->skbaddr;
-       ret = ah->ah_setup_tx_desc(ah, ds, skb->len + FCS_LEN,
+       ret = ah->ah_setup_tx_desc(ah, ds, skb->len,
                        ieee80211_get_hdrlen_from_skb(skb),
                        AR5K_PKT_TYPE_BEACON, (ctl->power_level * 2), ctl->tx_rate, 1,
                        AR5K_TXKEYIX_INVALID, antenna, flags, 0, 0);
@@ -1973,7 +1984,7 @@ ath5k_beacon_send(struct ath5k_softc *sc)
        struct ath5k_buf *bf = sc->bbuf;
        struct ath5k_hw *ah = sc->ah;
 
-       ATH5K_DBG(sc, ATH5K_DEBUG_BEACON_PROC, "in beacon_send\n");
+       ATH5K_DBG_UNLIMIT(sc, ATH5K_DEBUG_BEACON, "in beacon_send\n");
 
        if (unlikely(bf->skb == NULL || sc->opmode == IEEE80211_IF_TYPE_STA ||
                        sc->opmode == IEEE80211_IF_TYPE_MNTR)) {
@@ -1989,10 +2000,10 @@ ath5k_beacon_send(struct ath5k_softc *sc)
         */
        if (unlikely(ath5k_hw_num_tx_pending(ah, sc->bhalq) != 0)) {
                sc->bmisscount++;
-               ATH5K_DBG(sc, ATH5K_DEBUG_BEACON_PROC,
+               ATH5K_DBG(sc, ATH5K_DEBUG_BEACON,
                        "missed %u consecutive beacons\n", sc->bmisscount);
                if (sc->bmisscount > 3) {               /* NB: 3 is a guess */
-                       ATH5K_DBG(sc, ATH5K_DEBUG_BEACON_PROC,
+                       ATH5K_DBG(sc, ATH5K_DEBUG_BEACON,
                                "stuck beacon time (%u missed)\n",
                                sc->bmisscount);
                        tasklet_schedule(&sc->restq);
@@ -2000,7 +2011,7 @@ ath5k_beacon_send(struct ath5k_softc *sc)
                return;
        }
        if (unlikely(sc->bmisscount != 0)) {
-               ATH5K_DBG(sc, ATH5K_DEBUG_BEACON_PROC,
+               ATH5K_DBG(sc, ATH5K_DEBUG_BEACON,
                        "resume beacon xmit after %u misses\n",
                        sc->bmisscount);
                sc->bmisscount = 0;
@@ -2020,7 +2031,7 @@ ath5k_beacon_send(struct ath5k_softc *sc)
 
        ath5k_hw_put_tx_buf(ah, sc->bhalq, bf->daddr);
        ath5k_hw_tx_start(ah, sc->bhalq);
-       ATH5K_DBG(sc, ATH5K_DEBUG_BEACON_PROC, "TXDP[%u] = %llx (%p)\n",
+       ATH5K_DBG(sc, ATH5K_DEBUG_BEACON, "TXDP[%u] = %llx (%p)\n",
                sc->bhalq, (unsigned long long)bf->daddr, bf->desc);
 
        sc->bsent++;
@@ -2119,8 +2130,9 @@ ath5k_beacon_update_timers(struct ath5k_softc *sc, u64 bc_tsf)
                        "updated timers based on beacon TSF\n");
 
        ATH5K_DBG_UNLIMIT(sc, ATH5K_DEBUG_BEACON,
-               "bc_tsf %llx hw_tsf %llx bc_tu %u hw_tu %u nexttbtt %u\n",
-               bc_tsf, hw_tsf, bc_tu, hw_tu, nexttbtt);
+                         "bc_tsf %llx hw_tsf %llx bc_tu %u hw_tu %u nexttbtt %u\n",
+                         (unsigned long long) bc_tsf,
+                         (unsigned long long) hw_tsf, bc_tu, hw_tu, nexttbtt);
        ATH5K_DBG_UNLIMIT(sc, ATH5K_DEBUG_BEACON, "intval %u %s %s\n",
                intval & AR5K_BEACON_PERIOD,
                intval & AR5K_BEACON_ENA ? "AR5K_BEACON_ENA" : "",
@@ -2378,10 +2390,11 @@ ath5k_intr(int irq, void *dev_id)
                                        u64 tsf = ath5k_hw_get_tsf64(ah);
                                        sc->nexttbtt += sc->bintval;
                                        ATH5K_DBG(sc, ATH5K_DEBUG_BEACON,
-                                               "SWBA nexttbtt: %x hw_tu: %x "
-                                               "TSF: %llx\n",
-                                               sc->nexttbtt,
-                                               TSF_TO_TU(tsf), tsf);
+                                                 "SWBA nexttbtt: %x hw_tu: %x "
+                                                 "TSF: %llx\n",
+                                                 sc->nexttbtt,
+                                                 TSF_TO_TU(tsf),
+                                                 (unsigned long long) tsf);
                                } else {
                                        ath5k_beacon_send(sc);
                                }