kernel: add patch to inline mips dma mapping functions - reduces code size and improv...
[openwrt.git] / target / linux / generic / patches-3.10 / 130-mips_remove_plat_dma_functions.patch
1 From: Felix Fietkau <nbd@openwrt.org>
2 Subject: [PATCH 1/2] MIPS: remove unnecessary platform dma helper functions
3
4 Signed-off-by: Felix Fietkau <nbd@openwrt.org>
5 ---
6 --- a/arch/mips/mm/dma-default.c
7 +++ b/arch/mips/mm/dma-default.c
8 @@ -289,7 +289,6 @@ static void mips_dma_sync_single_for_cpu
9  static void mips_dma_sync_single_for_device(struct device *dev,
10         dma_addr_t dma_handle, size_t size, enum dma_data_direction direction)
11  {
12 -       plat_extra_sync_for_device(dev);
13         if (!plat_device_is_coherent(dev))
14                 __dma_sync(dma_addr_to_page(dev, dma_handle),
15                            dma_handle & ~PAGE_MASK, size, direction);
16 @@ -323,7 +322,7 @@ static void mips_dma_sync_sg_for_device(
17  
18  int mips_dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
19  {
20 -       return plat_dma_mapping_error(dev, dma_addr);
21 +       return 0;
22  }
23  
24  int mips_dma_supported(struct device *dev, u64 mask)
25 @@ -336,7 +335,6 @@ void dma_cache_sync(struct device *dev, 
26  {
27         BUG_ON(direction == DMA_NONE);
28  
29 -       plat_extra_sync_for_device(dev);
30         if (!plat_device_is_coherent(dev))
31                 __dma_sync_virtual(vaddr, size, direction);
32  }
33 --- a/arch/mips/include/asm/mach-cavium-octeon/dma-coherence.h
34 +++ b/arch/mips/include/asm/mach-cavium-octeon/dma-coherence.h
35 @@ -46,22 +46,11 @@ static inline int plat_dma_supported(str
36         BUG();
37  }
38  
39 -static inline void plat_extra_sync_for_device(struct device *dev)
40 -{
41 -       BUG();
42 -}
43 -
44  static inline int plat_device_is_coherent(struct device *dev)
45  {
46         return 1;
47  }
48  
49 -static inline int plat_dma_mapping_error(struct device *dev,
50 -                                        dma_addr_t dma_addr)
51 -{
52 -       BUG();
53 -}
54 -
55  dma_addr_t phys_to_dma(struct device *dev, phys_addr_t paddr);
56  phys_addr_t dma_to_phys(struct device *dev, dma_addr_t daddr);
57  
58 --- a/arch/mips/include/asm/mach-generic/dma-coherence.h
59 +++ b/arch/mips/include/asm/mach-generic/dma-coherence.h
60 @@ -47,16 +47,6 @@ static inline int plat_dma_supported(str
61         return 1;
62  }
63  
64 -static inline void plat_extra_sync_for_device(struct device *dev)
65 -{
66 -}
67 -
68 -static inline int plat_dma_mapping_error(struct device *dev,
69 -                                        dma_addr_t dma_addr)
70 -{
71 -       return 0;
72 -}
73 -
74  static inline int plat_device_is_coherent(struct device *dev)
75  {
76  #ifdef CONFIG_DMA_COHERENT
77 --- a/arch/mips/include/asm/mach-ip27/dma-coherence.h
78 +++ b/arch/mips/include/asm/mach-ip27/dma-coherence.h
79 @@ -58,16 +58,6 @@ static inline int plat_dma_supported(str
80         return 1;
81  }
82  
83 -static inline void plat_extra_sync_for_device(struct device *dev)
84 -{
85 -}
86 -
87 -static inline int plat_dma_mapping_error(struct device *dev,
88 -                                        dma_addr_t dma_addr)
89 -{
90 -       return 0;
91 -}
92 -
93  static inline int plat_device_is_coherent(struct device *dev)
94  {
95         return 1;               /* IP27 non-cohernet mode is unsupported */
96 --- a/arch/mips/include/asm/mach-ip32/dma-coherence.h
97 +++ b/arch/mips/include/asm/mach-ip32/dma-coherence.h
98 @@ -80,17 +80,6 @@ static inline int plat_dma_supported(str
99         return 1;
100  }
101  
102 -static inline void plat_extra_sync_for_device(struct device *dev)
103 -{
104 -       return;
105 -}
106 -
107 -static inline int plat_dma_mapping_error(struct device *dev,
108 -                                        dma_addr_t dma_addr)
109 -{
110 -       return 0;
111 -}
112 -
113  static inline int plat_device_is_coherent(struct device *dev)
114  {
115         return 0;               /* IP32 is non-cohernet */
116 --- a/arch/mips/include/asm/mach-jazz/dma-coherence.h
117 +++ b/arch/mips/include/asm/mach-jazz/dma-coherence.h
118 @@ -48,16 +48,6 @@ static inline int plat_dma_supported(str
119         return 1;
120  }
121  
122 -static inline void plat_extra_sync_for_device(struct device *dev)
123 -{
124 -}
125 -
126 -static inline int plat_dma_mapping_error(struct device *dev,
127 -                                        dma_addr_t dma_addr)
128 -{
129 -       return 0;
130 -}
131 -
132  static inline int plat_device_is_coherent(struct device *dev)
133  {
134         return 0;
135 --- a/arch/mips/include/asm/mach-loongson/dma-coherence.h
136 +++ b/arch/mips/include/asm/mach-loongson/dma-coherence.h
137 @@ -53,16 +53,6 @@ static inline int plat_dma_supported(str
138         return 1;
139  }
140  
141 -static inline void plat_extra_sync_for_device(struct device *dev)
142 -{
143 -}
144 -
145 -static inline int plat_dma_mapping_error(struct device *dev,
146 -                                        dma_addr_t dma_addr)
147 -{
148 -       return 0;
149 -}
150 -
151  static inline int plat_device_is_coherent(struct device *dev)
152  {
153         return 0;
154 --- a/arch/mips/include/asm/mach-powertv/dma-coherence.h
155 +++ b/arch/mips/include/asm/mach-powertv/dma-coherence.h
156 @@ -99,16 +99,6 @@ static inline int plat_dma_supported(str
157         return 1;
158  }
159  
160 -static inline void plat_extra_sync_for_device(struct device *dev)
161 -{
162 -}
163 -
164 -static inline int plat_dma_mapping_error(struct device *dev,
165 -                                        dma_addr_t dma_addr)
166 -{
167 -       return 0;
168 -}
169 -
170  static inline int plat_device_is_coherent(struct device *dev)
171  {
172         return 0;