[package] mac80211: update compat-wireless to 2009-01-29
[openwrt/svn-archive/archive.git] / package / mac80211 / patches / 320-rx_dma_unmap.patch
1 When freeing rx dma descriptors, use the right buffer size.
2 Fixes kernel oopses on module unload on ixp4xx and most likely
3 other platforms as well.
4
5 Signed-off-by: Felix Fietkau <nbd@openwrt.org>
6
7 --- a/drivers/net/wireless/ath5k/base.c
8 +++ b/drivers/net/wireless/ath5k/base.c
9 @@ -310,6 +310,19 @@ static inline void ath5k_txbuf_free(stru
10 bf->skb = NULL;
11 }
12
13 +static inline void ath5k_rxbuf_free(struct ath5k_softc *sc,
14 + struct ath5k_buf *bf)
15 +{
16 + BUG_ON(!bf);
17 + if (!bf->skb)
18 + return;
19 + pci_unmap_single(sc->pdev, bf->skbaddr, sc->rxbufsize,
20 + PCI_DMA_FROMDEVICE);
21 + dev_kfree_skb_any(bf->skb);
22 + bf->skb = NULL;
23 +}
24 +
25 +
26 /* Queues setup */
27 static struct ath5k_txq *ath5k_txq_setup(struct ath5k_softc *sc,
28 int qtype, int subtype);
29 @@ -1343,7 +1356,7 @@ ath5k_desc_free(struct ath5k_softc *sc,
30 list_for_each_entry(bf, &sc->txbuf, list)
31 ath5k_txbuf_free(sc, bf);
32 list_for_each_entry(bf, &sc->rxbuf, list)
33 - ath5k_txbuf_free(sc, bf);
34 + ath5k_rxbuf_free(sc, bf);
35
36 /* Free memory associated with all descriptors */
37 pci_free_consistent(pdev, sc->desc_len, sc->desc, sc->desc_daddr);