MIPS: mm: Move some checks out of 'for' loop in DMA operations
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 <1bc8cf2274d8680f3a9b88ac7b7d2a9e0d1d4ca2@broadcom.com>
Cc: 562397917b9a8bf316569a848858b12fb417723f@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/5907/
Reviewed-by: Markos Chandras <5cdbcb0e11d2b5ebc39222958c54a1c6329d0c9d@imgtec.com>
Tested-by: Markos Chandras <5cdbcb0e11d2b5ebc39222958c54a1c6329d0c9d@imgtec.com>
Signed-off-by: Ralf Baechle <92f48d309cda194c8eda36aa8f9ae28c488fa208@linux-mips.org>

KristFoundation/Programs,KristFoundation/Programs,KristFoundation/Programs,KristFoundation/Programs,KristFoundation/Programs,KristFoundation/Programs