ath10k: fix memory allocation issues on platforms where DMA coherent memory is constr...
[librecmc/librecmc.git] / package / kernel / mac80211 / patches / 317-ath10k-stop-abusing-GFP_DMA.patch
1 From: Felix Fietkau <nbd@openwrt.org>
2 Date: Tue, 24 Nov 2015 11:33:54 +0100
3 Subject: [PATCH] ath10k: stop abusing GFP_DMA
4
5 Allocations from the DMA zone were originally added for legacy ISA
6 stuff, or PCI devices that have specific limitations in their DMA
7 addressing capabilities. It has no place in ath10k, which can do
8 full 32-bit DMA.
9
10 Fixes memory allocation errors on some platforms.
11
12 Signed-off-by: Felix Fietkau <nbd@openwrt.org>
13 ---
14
15 --- a/drivers/net/wireless/ath/ath10k/htt_rx.c
16 +++ b/drivers/net/wireless/ath/ath10k/htt_rx.c
17 @@ -536,7 +536,7 @@ int ath10k_htt_rx_alloc(struct ath10k_ht
18  
19         size = htt->rx_ring.size * sizeof(htt->rx_ring.paddrs_ring);
20  
21 -       vaddr = dma_alloc_coherent(htt->ar->dev, size, &paddr, GFP_DMA);
22 +       vaddr = dma_alloc_coherent(htt->ar->dev, size, &paddr, GFP_KERNEL);
23         if (!vaddr)
24                 goto err_dma_ring;
25  
26 @@ -545,7 +545,7 @@ int ath10k_htt_rx_alloc(struct ath10k_ht
27  
28         vaddr = dma_alloc_coherent(htt->ar->dev,
29                                    sizeof(*htt->rx_ring.alloc_idx.vaddr),
30 -                                  &paddr, GFP_DMA);
31 +                                  &paddr, GFP_KERNEL);
32         if (!vaddr)
33                 goto err_dma_idx;
34  
35 --- a/drivers/net/wireless/ath/ath10k/htt_tx.c
36 +++ b/drivers/net/wireless/ath/ath10k/htt_tx.c
37 @@ -111,7 +111,7 @@ int ath10k_htt_tx_alloc(struct ath10k_ht
38         size = htt->max_num_pending_tx * sizeof(struct ath10k_htt_txbuf);
39         htt->txbuf.vaddr = dma_alloc_coherent(ar->dev, size,
40                                                   &htt->txbuf.paddr,
41 -                                                 GFP_DMA);
42 +                                                 GFP_KERNEL);
43         if (!htt->txbuf.vaddr) {
44                 ath10k_err(ar, "failed to alloc tx buffer\n");
45                 ret = -ENOMEM;
46 @@ -124,7 +124,7 @@ int ath10k_htt_tx_alloc(struct ath10k_ht
47         size = htt->max_num_pending_tx * sizeof(struct htt_msdu_ext_desc);
48         htt->frag_desc.vaddr = dma_alloc_coherent(ar->dev, size,
49                                                   &htt->frag_desc.paddr,
50 -                                                 GFP_DMA);
51 +                                                 GFP_KERNEL);
52         if (!htt->frag_desc.vaddr) {
53                 ath10k_warn(ar, "failed to alloc fragment desc memory\n");
54                 ret = -ENOMEM;