fix a small race condition in the madwifi queue handling
[openwrt.git] / package / madwifi / patches / 326-soc_dma.patch
1 Index: madwifi-trunk-r3280/ath/if_ath_ahb.c
2 ===================================================================
3 --- madwifi-trunk-r3280.orig/ath/if_ath_ahb.c 2008-01-28 20:00:18.552163264 +0100
4 +++ madwifi-trunk-r3280/ath/if_ath_ahb.c 2008-01-28 20:00:18.612166683 +0100
5 @@ -69,27 +69,13 @@
6 void *
7 bus_alloc_consistent(void *hwdev, size_t size, dma_addr_t *dma_handle)
8 {
9 - void *ret;
10 -
11 - ret = (void *) __get_free_pages(GFP_ATOMIC, get_order(size));
12 -
13 - if (ret != NULL) {
14 - memset(ret, 0, size);
15 - *dma_handle = __pa(ret);
16 - dma_cache_wback_inv((unsigned long) ret, size);
17 - ret = UNCAC_ADDR(ret);
18 - }
19 -
20 - return ret;
21 + return dma_alloc_coherent(hwdev, size, dma_handle, GFP_ATOMIC);
22 }
23
24 void
25 bus_free_consistent(void *hwdev, size_t size, void *vaddr, dma_addr_t dma_handle)
26 {
27 - unsigned long addr = (unsigned long) vaddr;
28 -
29 - addr = CAC_ADDR(addr);
30 - free_pages(addr, get_order(size));
31 + dma_free_coherent(hwdev, size, vaddr, dma_handle);
32 }
33
34 static int
35 Index: madwifi-trunk-r3280/ath/if_ath_ahb.h
36 ===================================================================
37 --- madwifi-trunk-r3280.orig/ath/if_ath_ahb.h 2008-01-28 19:52:49.442569967 +0100
38 +++ madwifi-trunk-r3280/ath/if_ath_ahb.h 2008-01-28 21:55:51.325773888 +0100
39 @@ -8,6 +8,7 @@
40 #ifndef _DEV_ATH_AHB_H_
41 #define _DEV_ATH_AHB_H_
42
43 +#include <linux/dma-mapping.h>
44 #include <asm/io.h>
45 #include <asm/uaccess.h>
46
47 @@ -89,8 +90,8 @@
48 #define AR531X_RADIO1_MASK 0x000c
49 #define AR531X_RADIO1_S 2
50
51 -#define BUS_DMA_FROMDEVICE 0
52 -#define BUS_DMA_TODEVICE 1
53 +#define BUS_DMA_FROMDEVICE DMA_FROM_DEVICE
54 +#define BUS_DMA_TODEVICE DMA_TO_DEVICE
55
56 #define AR531X_APBBASE 0xbc000000
57 #define AR531X_RESETTMR (AR531X_APBBASE + 0x3000)
58 @@ -115,29 +116,19 @@
59 static __inline void bus_dma_sync_single(void *hwdev, dma_addr_t dma_handle,
60 size_t size, int direction)
61 {
62 - unsigned long addr;
63 -
64 - addr = (unsigned long) __va(dma_handle);
65 - dma_cache_wback_inv(addr, size);
66 + dma_sync_single(hwdev, dma_handle, size, direction);
67 }
68
69 static __inline dma_addr_t bus_map_single(void *hwdev, void *ptr,
70 size_t size, int direction)
71 {
72 - dma_cache_wback_inv((unsigned long) ptr, size);
73 -
74 - return __pa(ptr);
75 + return dma_map_single(hwdev, ptr, size, direction);
76 }
77
78 static __inline void bus_unmap_single(void *hwdev, dma_addr_t dma_addr,
79 size_t size, int direction)
80 {
81 - if (direction != BUS_DMA_TODEVICE) {
82 - unsigned long addr;
83 -
84 - addr = (unsigned long)__va(dma_addr);
85 - dma_cache_wback_inv(addr, size);
86 - }
87 + dma_unmap_single(hwdev, dma_addr, size, direction);
88 }
89 void *bus_alloc_consistent(void *, size_t, dma_addr_t *);
90 void bus_free_consistent(void *, size_t, void *, dma_addr_t);
This page took 0.0439 seconds and 5 git commands to generate.