staging: brcm80211: remove macro usage for sk_buff release
authorArend van Spriel <arend@broadcom.com>
Sat, 4 Dec 2010 15:35:43 +0000 (16:35 +0100)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 7 Dec 2010 00:08:31 +0000 (16:08 -0800)
PKTFREE macro calls osl_pktfree. This function has been renamed to
pkt_buf_free_skb as it comprises of functionality additional to
dev_kfree_skb(_any) function and to get rid of the OSL concept in
this driver.

Reviewed-by: Brett Rudley <brudley@broadcom.com>
Reviewed-by: Dowan Kim <dowan@broadcom.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/staging/brcm80211/brcmfmac/bcmsdh_sdmmc.c
drivers/staging/brcm80211/brcmfmac/dhd_common.c
drivers/staging/brcm80211/brcmfmac/dhd_sdio.c
drivers/staging/brcm80211/include/osl.h
drivers/staging/brcm80211/sys/wlc_bmac.c
drivers/staging/brcm80211/sys/wlc_mac80211.c
drivers/staging/brcm80211/util/bcmutils.c
drivers/staging/brcm80211/util/hnddma.c
drivers/staging/brcm80211/util/linux_osl.c

index b8eb589cdaab04ea17f7fc3d8a69ce6304ab8bc5..d399b5c76f94a0d10087281ac1eec3db452429a5 100644 (file)
@@ -1057,7 +1057,7 @@ sdioh_request_buffer(sdioh_info_t *sd, uint pio_dma, uint fix_inc, uint write,
                if (!write)
                        bcopy(mypkt->data, buffer, buflen_u);
 
-               PKTFREE(sd->osh, mypkt, write ? true : false);
+               pkt_buf_free_skb(sd->osh, mypkt, write ? true : false);
        } else if (((u32) (pkt->data) & DMA_ALIGN_MASK) != 0) {
                /* Case 2: We have a packet, but it is unaligned. */
 
@@ -1084,7 +1084,7 @@ sdioh_request_buffer(sdioh_info_t *sd, uint pio_dma, uint fix_inc, uint write,
                if (!write)
                        bcopy(mypkt->data, pkt->data, mypkt->len);
 
-               PKTFREE(sd->osh, mypkt, write ? true : false);
+               pkt_buf_free_skb(sd->osh, mypkt, write ? true : false);
        } else {                /* case 3: We have a packet and
                                 it is aligned. */
                sd_data(("%s: Aligned %s Packet, direct DMA\n",
index ce5f9134055c8406a560d79858edc90e378d799d..324d020b864e23ca93ae96a53a4db88efeb263b0 100644 (file)
@@ -368,7 +368,7 @@ bool dhd_prec_enq(dhd_pub_t *dhdp, struct pktq *q, struct sk_buff *pkt,
                        ASSERT(p);
                }
 
-               PKTFREE(dhdp->osh, p, true);
+               pkt_buf_free_skb(dhdp->osh, p, true);
        }
 
        /* Enqueue */
index c054f0d5015278941b7285b83d0ecbe044d03fe8..3edce44978a1ff3eec3e0dfe9bb15f828cf82e72 100644 (file)
  * bufpool was present for gspi bus.
  */
 #define PKTFREE2()             if ((bus->bus != SPI_BUS) || bus->usebufpool) \
-                                       PKTFREE(bus->dhd->osh, pkt, false);
+                                                       pkt_buf_free_skb(bus->dhd->osh, pkt, false);
 DHD_SPINWAIT_SLEEP_INIT(sdioh_spinwait_sleep);
 extern int dhdcdc_set_ioctl(dhd_pub_t *dhd, int ifidx, uint cmd, void *buf,
                            uint len);
@@ -948,7 +948,7 @@ static int dhdsdio_txpkt(dhd_bus_t *bus, struct sk_buff *pkt, uint chan,
                        PKTALIGN(osh, new, pkt->len, DHD_SDALIGN);
                        bcopy(pkt->data, new->data, pkt->len);
                        if (free_pkt)
-                               PKTFREE(osh, pkt, true);
+                               pkt_buf_free_skb(osh, pkt, true);
                        /* free the pkt if canned one is not used */
                        free_pkt = true;
                        pkt = new;
@@ -1061,7 +1061,7 @@ done:
        dhd_os_sdlock(bus->dhd);
 
        if (free_pkt)
-               PKTFREE(osh, pkt, true);
+               pkt_buf_free_skb(osh, pkt, true);
 
        return ret;
 }
@@ -1112,7 +1112,7 @@ int dhd_bus_txdata(struct dhd_bus *bus, struct sk_buff *pkt)
                if (dhd_prec_enq(bus->dhd, &bus->txq, pkt, prec) == false) {
                        skb_pull(pkt, SDPCM_HDRLEN);
                        dhd_txcomplete(bus->dhd, pkt, false);
-                       PKTFREE(osh, pkt, true);
+                       pkt_buf_free_skb(osh, pkt, true);
                        DHD_ERROR(("%s: out of bus->txq !!!\n", __func__));
                        ret = BCME_NORESOURCE;
                } else {
@@ -2882,10 +2882,10 @@ void dhd_bus_stop(struct dhd_bus *bus, bool enforce_mutex)
 
        /* Clear any held glomming stuff */
        if (bus->glomd)
-               PKTFREE(osh, bus->glomd, false);
+               pkt_buf_free_skb(osh, bus->glomd, false);
 
        if (bus->glom)
-               PKTFREE(osh, bus->glom, false);
+               pkt_buf_free_skb(osh, bus->glom, false);
 
        bus->glom = bus->glomd = NULL;
 
@@ -3276,13 +3276,13 @@ static u8 dhdsdio_rxglom(dhd_bus_t *bus, u8 rxseq)
                        pfirst = pnext = NULL;
                } else {
                        if (pfirst)
-                               PKTFREE(osh, pfirst, false);
+                               pkt_buf_free_skb(osh, pfirst, false);
                        bus->glom = NULL;
                        num = 0;
                }
 
                /* Done with descriptor packet */
-               PKTFREE(osh, bus->glomd, false);
+               pkt_buf_free_skb(osh, bus->glomd, false);
                bus->glomd = NULL;
                bus->nextlen = 0;
 
@@ -3351,7 +3351,7 @@ static u8 dhdsdio_rxglom(dhd_bus_t *bus, u8 rxseq)
                                bus->glomerr = 0;
                                dhdsdio_rxfail(bus, true, false);
                                dhd_os_sdlock_rxq(bus->dhd);
-                               PKTFREE(osh, bus->glom, false);
+                               pkt_buf_free_skb(osh, bus->glom, false);
                                dhd_os_sdunlock_rxq(bus->dhd);
                                bus->rxglomfail++;
                                bus->glom = NULL;
@@ -3480,7 +3480,7 @@ static u8 dhdsdio_rxglom(dhd_bus_t *bus, u8 rxseq)
                                bus->glomerr = 0;
                                dhdsdio_rxfail(bus, true, false);
                                dhd_os_sdlock_rxq(bus->dhd);
-                               PKTFREE(osh, bus->glom, false);
+                               pkt_buf_free_skb(osh, bus->glom, false);
                                dhd_os_sdunlock_rxq(bus->dhd);
                                bus->rxglomfail++;
                                bus->glom = NULL;
@@ -3528,7 +3528,7 @@ static u8 dhdsdio_rxglom(dhd_bus_t *bus, u8 rxseq)
                        skb_pull(pfirst, doff);
 
                        if (pfirst->len == 0) {
-                               PKTFREE(bus->dhd->osh, pfirst, false);
+                               pkt_buf_free_skb(bus->dhd->osh, pfirst, false);
                                if (plast) {
                                        plast->next = pnext;
                                } else {
@@ -3541,7 +3541,7 @@ static u8 dhdsdio_rxglom(dhd_bus_t *bus, u8 rxseq)
                                DHD_ERROR(("%s: rx protocol error\n",
                                           __func__));
                                bus->dhd->rx_errors++;
-                               PKTFREE(osh, pfirst, false);
+                               pkt_buf_free_skb(osh, pfirst, false);
                                if (plast) {
                                        plast->next = pnext;
                                } else {
@@ -3753,7 +3753,7 @@ static uint dhdsdio_readframes(dhd_bus_t *bus, uint maxframes, bool *finished)
                                if (sdret < 0) {
                                        DHD_ERROR(("%s (nextlen): read %d bytes failed: %d\n",
                                                __func__, rdlen, sdret));
-                                       PKTFREE(bus->dhd->osh, pkt, false);
+                                       pkt_buf_free_skb(bus->dhd->osh, pkt, false);
                                        bus->dhd->rx_errors++;
                                        dhd_os_sdunlock_rxq(bus->dhd);
                                        /* Force retry w/normal header read.
@@ -3901,7 +3901,7 @@ static uint dhdsdio_readframes(dhd_bus_t *bus, uint maxframes, bool *finished)
                                                             doff);
                                        if (bus->usebufpool) {
                                                dhd_os_sdlock_rxq(bus->dhd);
-                                               PKTFREE(bus->dhd->osh, pkt,
+                                               pkt_buf_free_skb(bus->dhd->osh, pkt,
                                                        false);
                                                dhd_os_sdunlock_rxq(bus->dhd);
                                        }
@@ -4127,7 +4127,7 @@ static uint dhdsdio_readframes(dhd_bus_t *bus, uint maxframes, bool *finished)
                                       ? "data" : "test")),
                                   sdret));
                        dhd_os_sdlock_rxq(bus->dhd);
-                       PKTFREE(bus->dhd->osh, pkt, false);
+                       pkt_buf_free_skb(bus->dhd->osh, pkt, false);
                        dhd_os_sdunlock_rxq(bus->dhd);
                        bus->dhd->rx_errors++;
                        dhdsdio_rxfail(bus, true, RETRYCHAN(chan));
@@ -4180,13 +4180,13 @@ deliver:
 
                if (pkt->len == 0) {
                        dhd_os_sdlock_rxq(bus->dhd);
-                       PKTFREE(bus->dhd->osh, pkt, false);
+                       pkt_buf_free_skb(bus->dhd->osh, pkt, false);
                        dhd_os_sdunlock_rxq(bus->dhd);
                        continue;
                } else if (dhd_prot_hdrpull(bus->dhd, &ifidx, pkt) != 0) {
                        DHD_ERROR(("%s: rx protocol error\n", __func__));
                        dhd_os_sdlock_rxq(bus->dhd);
-                       PKTFREE(bus->dhd->osh, pkt, false);
+                       pkt_buf_free_skb(bus->dhd->osh, pkt, false);
                        dhd_os_sdunlock_rxq(bus->dhd);
                        bus->dhd->rx_errors++;
                        continue;
@@ -4694,7 +4694,7 @@ static void dhdsdio_pktgen(dhd_bus_t *bus)
                default:
                        DHD_ERROR(("Unrecognized pktgen mode %d\n",
                                   bus->pktgen_mode));
-                       PKTFREE(osh, pkt, true);
+                       pkt_buf_free_skb(osh, pkt, true);
                        bus->pktgen_count = 0;
                        return;
                }
@@ -4779,7 +4779,7 @@ static void dhdsdio_testrcv(dhd_bus_t *bus, struct sk_buff *pkt, uint seq)
        if (pktlen < SDPCM_TEST_HDRLEN) {
                DHD_ERROR(("dhdsdio_restrcv: toss runt frame, pktlen %d\n",
                           pktlen));
-               PKTFREE(osh, pkt, false);
+               pkt_buf_free_skb(osh, pkt, false);
                return;
        }
 
@@ -4797,7 +4797,7 @@ static void dhdsdio_testrcv(dhd_bus_t *bus, struct sk_buff *pkt, uint seq)
                        DHD_ERROR(("dhdsdio_testrcv: frame length mismatch, "
                                "pktlen %d seq %d" " cmd %d extra %d len %d\n",
                                pktlen, seq, cmd, extra, len));
-                       PKTFREE(osh, pkt, false);
+                       pkt_buf_free_skb(osh, pkt, false);
                        return;
                }
        }
@@ -4812,14 +4812,14 @@ static void dhdsdio_testrcv(dhd_bus_t *bus, struct sk_buff *pkt, uint seq)
                        bus->pktgen_sent++;
                } else {
                        bus->pktgen_fail++;
-                       PKTFREE(osh, pkt, false);
+                       pkt_buf_free_skb(osh, pkt, false);
                }
                bus->pktgen_rcvd++;
                break;
 
        case SDPCM_TEST_ECHORSP:
                if (bus->ext_loop) {
-                       PKTFREE(osh, pkt, false);
+                       pkt_buf_free_skb(osh, pkt, false);
                        bus->pktgen_rcvd++;
                        break;
                }
@@ -4832,12 +4832,12 @@ static void dhdsdio_testrcv(dhd_bus_t *bus, struct sk_buff *pkt, uint seq)
                                break;
                        }
                }
-               PKTFREE(osh, pkt, false);
+               pkt_buf_free_skb(osh, pkt, false);
                bus->pktgen_rcvd++;
                break;
 
        case SDPCM_TEST_DISCARD:
-               PKTFREE(osh, pkt, false);
+               pkt_buf_free_skb(osh, pkt, false);
                bus->pktgen_rcvd++;
                break;
 
@@ -4847,7 +4847,7 @@ static void dhdsdio_testrcv(dhd_bus_t *bus, struct sk_buff *pkt, uint seq)
                DHD_INFO(("dhdsdio_testrcv: unsupported or unknown command, "
                        "pktlen %d seq %d" " cmd %d extra %d len %d\n",
                        pktlen, seq, cmd, extra, len));
-               PKTFREE(osh, pkt, false);
+               pkt_buf_free_skb(osh, pkt, false);
                break;
        }
 
index 4d5893a70dd29fb09b67d593508f8e69be6e6132..b28235618d8b9e7599bb691f8802b0007769590e 100644 (file)
@@ -208,9 +208,7 @@ extern void osl_dma_unmap(struct osl_info *osh, uint pa, uint size,
 #define        bcopy(src, dst, len)    memcpy((dst), (src), (len))
 
 /* packet primitives */
-#define        PKTFREE(osh, skb, send) osl_pktfree((osh), (skb), (send))
-
 extern struct sk_buff *pkt_buf_get_skb(struct osl_info *osh, uint len);
-extern void osl_pktfree(struct osl_info *osh, void *skb, bool send);
+extern void pkt_buf_free_skb(struct osl_info *osh, struct sk_buff *skb, bool send);
 
 #endif /* _osl_h_ */
index 2abee6f527f93073ed6c42e822eeaaf36c6a5980..59bfeb063650037966305a2f848b201576dec6bb 100644 (file)
@@ -3336,7 +3336,7 @@ static bool wlc_bmac_txstatus_corerev4(wlc_hw_info_t *wlc_hw)
 
                fatal = wlc_bmac_dotxstatus(wlc_hw, txs, 0);
 
-               PKTFREE(osh, status_p, false);
+               pkt_buf_free_skb(osh, status_p, false);
        }
 
        if (fatal)
index 3e31f893fcc3accac39f3c382d8ef3157aa04b8b..d3246b754c41fff05e1656be03cc06aff76f182d 100644 (file)
@@ -5052,7 +5052,7 @@ wlc_prec_enq_head(struct wlc_info *wlc, struct pktq *q, struct sk_buff *pkt,
                }
 
                ASSERT(0);
-               PKTFREE(wlc->osh, p, true);
+               pkt_buf_free_skb(wlc->osh, p, true);
                WLCNTINCR(wlc->pub->_cnt->txnobuf);
        }
 
@@ -5085,7 +5085,7 @@ void BCMFASTPATH wlc_txq_enq(void *ctx, struct scb *scb, struct sk_buff *sdu,
                                  wlc->pub->unit));
 
                /* ASSERT(9 == 8); *//* XXX we might hit this condtion in case packet flooding from mac80211 stack */
-               PKTFREE(wlc->osh, sdu, true);
+               pkt_buf_free_skb(wlc->osh, sdu, true);
                WLCNTINCR(wlc->pub->_cnt->txnobuf);
        }
 
@@ -6671,7 +6671,7 @@ wlc_dotxstatus(struct wlc_info *wlc, tx_status_t *txs, u32 frm_tx2)
  fatal:
        ASSERT(0);
        if (p)
-               PKTFREE(osh, p, true);
+               pkt_buf_free_skb(osh, p, true);
 
        return true;
 
@@ -7056,7 +7056,7 @@ void BCMFASTPATH wlc_recv(struct wlc_info *wlc, struct sk_buff *p)
        return;
 
  toss:
-       PKTFREE(osh, p, false);
+       pkt_buf_free_skb(osh, p, false);
 }
 
 /* calculate frame duration for Mixed-mode L-SIG spoofing, return
index 9c4d46764aca2619be9f1c76ff444212f23b7815..fd30cc6fb7f8e7c549031cde239be91dab98f473 100644 (file)
@@ -198,7 +198,7 @@ void pktq_pflush(struct osl_info *osh, struct pktq *pq, int prec, bool dir)
        while (p) {
                q->head = p->prev;
                p->prev = NULL;
-               PKTFREE(osh, p, dir);
+               pkt_buf_free_skb(osh, p, dir);
                q->len--;
                pq->len--;
                p = q->head;
@@ -232,7 +232,7 @@ pktq_pflush(struct osl_info *osh, struct pktq *pq, int prec, bool dir,
                        else
                                prev->prev = p->prev;
                        p->prev = NULL;
-                       PKTFREE(osh, p, dir);
+                       pkt_buf_free_skb(osh, p, dir);
                        q->len--;
                        pq->len--;
                        p = (head ? q->head : prev->prev);
index a7805a88b5fea23841733e9517975424e1eecbe6..cf9e469af9886d7804de002d87085509dc9802b3 100644 (file)
@@ -1046,7 +1046,7 @@ static void *BCMFASTPATH _dma_rx(dma_info_t *di)
                if ((di->hnddma.dmactrlflags & DMA_CTRL_RXMULTI) == 0) {
                        DMA_ERROR(("%s: dma_rx: bad frame length (%d)\n",
                                   di->name, len));
-                       PKTFREE(di->osh, head, false);
+                       pkt_buf_free_skb(di->osh, head, false);
                        di->hnddma.rxgiants++;
                        goto next_frame;
                }
@@ -1230,15 +1230,10 @@ static void _dma_rxreclaim(dma_info_t *di)
 {
        void *p;
 
-       /* "unused local" warning suppression for OSLs that
-        * define PKTFREE() without using the di->osh arg
-        */
-       di = di;
-
        DMA_TRACE(("%s: dma_rxreclaim\n", di->name));
 
        while ((p = _dma_getnextrxp(di, true)))
-               PKTFREE(di->osh, p, false);
+               pkt_buf_free_skb(di->osh, p, false);
 }
 
 static void *BCMFASTPATH _dma_getnextrxp(dma_info_t *di, bool forceall)
@@ -1501,7 +1496,7 @@ static void dma32_txreclaim(dma_info_t *di, txd_range_t range)
                return;
 
        while ((p = dma32_getnexttxp(di, range)))
-               PKTFREE(di->osh, p, true);
+               pkt_buf_free_skb(di->osh, p, true);
 }
 
 static bool dma32_txstopped(dma_info_t *di)
@@ -1772,7 +1767,7 @@ static int dma32_txfast(dma_info_t *di, struct sk_buff *p0, bool commit)
 
  outoftxd:
        DMA_ERROR(("%s: dma_txfast: out of txds\n", di->name));
-       PKTFREE(di->osh, p0, true);
+       pkt_buf_free_skb(di->osh, p0, true);
        di->hnddma.txavail = 0;
        di->hnddma.txnobuf++;
        return -1;
@@ -2071,7 +2066,7 @@ static void BCMFASTPATH dma64_txreclaim(dma_info_t *di, txd_range_t range)
        while ((p = dma64_getnexttxp(di, range))) {
                /* For unframed data, we don't have any packets to free */
                if (!(di->hnddma.dmactrlflags & DMA_CTRL_UNFRAMED))
-                       PKTFREE(di->osh, p, true);
+                       pkt_buf_free_skb(di->osh, p, true);
        }
 }
 
@@ -2422,7 +2417,7 @@ static int BCMFASTPATH dma64_txfast(dma_info_t *di, struct sk_buff *p0,
 
  outoftxd:
        DMA_ERROR(("%s: dma_txfast: out of txds !!!\n", di->name));
-       PKTFREE(di->osh, p0, true);
+       pkt_buf_free_skb(di->osh, p0, true);
        di->hnddma.txavail = 0;
        di->hnddma.txnobuf++;
        return -1;
index cd78edbcf43f9acc3ed14189f834aaa6b3a36b39..e6716e823baa3eeca534d17b927d7c3a293d58ac 100644 (file)
@@ -95,12 +95,11 @@ struct sk_buff *BCMFASTPATH pkt_buf_get_skb(struct osl_info *osh, uint len)
 }
 
 /* Free the driver packet. Free the tag if present */
-void BCMFASTPATH osl_pktfree(struct osl_info *osh, void *p, bool send)
+void BCMFASTPATH pkt_buf_free_skb(struct osl_info *osh, struct sk_buff *skb, bool send)
 {
-       struct sk_buff *skb, *nskb;
+       struct sk_buff *nskb;
        int nest = 0;
 
-       skb = (struct sk_buff *)p;
        ASSERT(skb);
 
        /* perversion: we use skb->next to chain multi-skb packets */