ath5k: use common ath.ko ath_rxbuf_alloc()
authorLuis R. Rodriguez <lrodriguez@atheros.com>
Wed, 12 Aug 2009 16:57:00 +0000 (09:57 -0700)
committerJohn W. Linville <linville@tuxdriver.com>
Fri, 14 Aug 2009 13:14:06 +0000 (09:14 -0400)
Now that its shared we can remove ath5k's own implementation.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/ath/ath5k/base.c
drivers/net/wireless/ath/ath5k/base.h

index acbcfc2a9f71ea2dee2f9dba6f6e9c8cb1f941f0..63c2b5714d2fd6c0897cc1408d75a13cc8160bef 100644 (file)
@@ -544,7 +544,7 @@ ath5k_pci_probe(struct pci_dev *pdev,
        __set_bit(ATH_STAT_INVALID, sc->status);
 
        sc->iobase = mem; /* So we can unmap it on detach */
-       sc->cachelsz = csz * sizeof(u32); /* convert to bytes */
+       sc->common.cachelsz = csz * sizeof(u32); /* convert to bytes */
        sc->opmode = NL80211_IFTYPE_STATION;
        sc->bintval = 1000;
        mutex_init(&sc->lock);
@@ -1151,27 +1151,20 @@ static
 struct sk_buff *ath5k_rx_skb_alloc(struct ath5k_softc *sc, dma_addr_t *skb_addr)
 {
        struct sk_buff *skb;
-       unsigned int off;
 
        /*
         * Allocate buffer with headroom_needed space for the
         * fake physical layer header at the start.
         */
-       skb = dev_alloc_skb(sc->rxbufsize + sc->cachelsz - 1);
+       skb = ath_rxbuf_alloc(&sc->common,
+                             sc->rxbufsize + sc->common.cachelsz - 1,
+                             GFP_ATOMIC);
 
        if (!skb) {
                ATH5K_ERR(sc, "can't alloc skbuff of size %u\n",
-                               sc->rxbufsize + sc->cachelsz - 1);
+                               sc->rxbufsize + sc->common.cachelsz - 1);
                return NULL;
        }
-       /*
-        * Cache-line-align.  This is important (for the
-        * 5210 at least) as not doing so causes bogus data
-        * in rx'd frames.
-        */
-       off = ((unsigned long)skb->data) % sc->cachelsz;
-       if (off != 0)
-               skb_reserve(skb, sc->cachelsz - off);
 
        *skb_addr = pci_map_single(sc->pdev,
                skb->data, sc->rxbufsize, PCI_DMA_FROMDEVICE);
@@ -1613,10 +1606,10 @@ ath5k_rx_start(struct ath5k_softc *sc)
        struct ath5k_buf *bf;
        int ret;
 
-       sc->rxbufsize = roundup(IEEE80211_MAX_LEN, sc->cachelsz);
+       sc->rxbufsize = roundup(IEEE80211_MAX_LEN, sc->common.cachelsz);
 
        ATH5K_DBG(sc, ATH5K_DEBUG_RESET, "cachelsz %u rxbufsize %u\n",
-               sc->cachelsz, sc->rxbufsize);
+               sc->common.cachelsz, sc->rxbufsize);
 
        spin_lock_bh(&sc->rxbuflock);
        sc->rxlink = NULL;
index 667bd9dc190063c3b33fd016345dd70d3277b57c..25a72a85aaa5dafc41ae0d845cd6266e4336f82e 100644 (file)
@@ -50,6 +50,7 @@
 
 #include "ath5k.h"
 #include "debug.h"
+#include "../ath.h"
 
 #define        ATH_RXBUF       40              /* number of RX buffers */
 #define        ATH_TXBUF       200             /* number of TX buffers */
@@ -112,6 +113,7 @@ struct ath5k_rfkill {
  * associated with an instance of a device */
 struct ath5k_softc {
        struct pci_dev          *pdev;          /* for dma mapping */
+       struct ath_common       common;
        void __iomem            *iobase;        /* address of the device */
        struct mutex            lock;           /* dev-level lock */
        struct ieee80211_tx_queue_stats tx_stats[AR5K_NUM_TX_QUEUES];
@@ -134,7 +136,6 @@ struct ath5k_softc {
        struct ath5k_desc       *desc;          /* TX/RX descriptors */
        dma_addr_t              desc_daddr;     /* DMA (physical) address */
        size_t                  desc_len;       /* size of TX/RX descriptors */
-       u16                     cachelsz;       /* cache line size */
 
        DECLARE_BITMAP(status, 5);
 #define ATH_STAT_INVALID       0               /* disable hardware accesses */