diff options
author | Jayachandran C <jchandra@broadcom.com> | 2013-09-25 09:01:05 -0400 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2013-09-25 11:05:44 -0400 |
commit | 55c25c2f14496badefd780a9f179442756216b67 (patch) | |
tree | c29c3c8e3456328acdcd6f6d26079948eaad0429 /arch/mips | |
parent | becee6b8c7b2b4adc9a3e0bec633abecd591b9ef (diff) |
MIPS: mm: Move some checks out of 'for' loop in DMA operations
The check cpu_needs_post_dma_flush() in mips_dma_sync_sg_for_cpu() and
the check !plat_device_is_coherent() in mips_dma_sync_sg_for_device()
can be moved outside the for loop.
As a side effect, this also avoids a GCC bug that caused kernel compile
to fail with the error:
arch/mips/mm/dma-default.c: In function 'mips_dma_sync_sg_for_cpu':
arch/mips/mm/dma-default.c:316:1: internal compiler error: in add_insn_before, at emit-rtl.c:3852
This gcc failure is seen in Code Sourcery toolchains [e.g. gcc version
4.7.2 (Sourcery CodeBench Lite 2012.09-99)] after commit "MIPS: Optimize
current_cpu_type() for better code."
Signed-off-by: Jayachandran C <jchandra@broadcom.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/5907/
Reviewed-by: Markos Chandras <markos.chandras@imgtec.com>
Tested-by: Markos Chandras <markos.chandras@imgtec.com>
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips')
-rw-r--r-- | arch/mips/mm/dma-default.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/arch/mips/mm/dma-default.c b/arch/mips/mm/dma-default.c index f25a7e9f8cbc..5f8b95512580 100644 --- a/arch/mips/mm/dma-default.c +++ b/arch/mips/mm/dma-default.c | |||
@@ -308,12 +308,10 @@ static void mips_dma_sync_sg_for_cpu(struct device *dev, | |||
308 | { | 308 | { |
309 | int i; | 309 | int i; |
310 | 310 | ||
311 | /* Make sure that gcc doesn't leave the empty loop body. */ | 311 | if (cpu_needs_post_dma_flush(dev)) |
312 | for (i = 0; i < nelems; i++, sg++) { | 312 | for (i = 0; i < nelems; i++, sg++) |
313 | if (cpu_needs_post_dma_flush(dev)) | ||
314 | __dma_sync(sg_page(sg), sg->offset, sg->length, | 313 | __dma_sync(sg_page(sg), sg->offset, sg->length, |
315 | direction); | 314 | direction); |
316 | } | ||
317 | } | 315 | } |
318 | 316 | ||
319 | static void mips_dma_sync_sg_for_device(struct device *dev, | 317 | static void mips_dma_sync_sg_for_device(struct device *dev, |
@@ -321,12 +319,10 @@ static void mips_dma_sync_sg_for_device(struct device *dev, | |||
321 | { | 319 | { |
322 | int i; | 320 | int i; |
323 | 321 | ||
324 | /* Make sure that gcc doesn't leave the empty loop body. */ | 322 | if (!plat_device_is_coherent(dev)) |
325 | for (i = 0; i < nelems; i++, sg++) { | 323 | for (i = 0; i < nelems; i++, sg++) |
326 | if (!plat_device_is_coherent(dev)) | ||
327 | __dma_sync(sg_page(sg), sg->offset, sg->length, | 324 | __dma_sync(sg_page(sg), sg->offset, sg->length, |
328 | direction); | 325 | direction); |
329 | } | ||
330 | } | 326 | } |
331 | 327 | ||
332 | int mips_dma_mapping_error(struct device *dev, dma_addr_t dma_addr) | 328 | int mips_dma_mapping_error(struct device *dev, dma_addr_t dma_addr) |