Skip to content

Commit cfa93fb

Browse files
paulburtonralfbaechle
authored andcommitted
MIPS: dma-default: Don't check hw_coherentio if device is non-coherent
There are no cases where plat_device_is_coherent() will return zero whilst hw_coherentio is non-zero, and acting any differently in such a case doesn't make much sense - if a device is non-coherent with the CPU caches then access to memory "coherent" with DMA must be uncached. Clean up the nonsensical case. Signed-off-by: Paul Burton <paul.burton@imgtec.com> Cc: linux-mips@linux-mips.org Patchwork: https://patchwork.linux-mips.org/patch/14348/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
1 parent f230202 commit cfa93fb

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

arch/mips/mm/dma-default.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,7 @@ static void *mips_dma_alloc_coherent(struct device *dev, size_t size,
161161
*dma_handle = plat_map_dma_mem(dev, ret, size);
162162
if (!plat_device_is_coherent(dev)) {
163163
dma_cache_wback_inv((unsigned long) ret, size);
164-
if (!hw_coherentio)
165-
ret = UNCAC_ADDR(ret);
164+
ret = UNCAC_ADDR(ret);
166165
}
167166

168167
return ret;
@@ -190,7 +189,7 @@ static void mips_dma_free_coherent(struct device *dev, size_t size, void *vaddr,
190189

191190
plat_unmap_dma_mem(dev, dma_handle, size, DMA_BIDIRECTIONAL);
192191

193-
if (!plat_device_is_coherent(dev) && !hw_coherentio)
192+
if (!plat_device_is_coherent(dev))
194193
addr = CAC_ADDR(addr);
195194

196195
page = virt_to_page((void *) addr);
@@ -210,7 +209,7 @@ static int mips_dma_mmap(struct device *dev, struct vm_area_struct *vma,
210209
unsigned long pfn;
211210
int ret = -ENXIO;
212211

213-
if (!plat_device_is_coherent(dev) && !hw_coherentio)
212+
if (!plat_device_is_coherent(dev))
214213
addr = CAC_ADDR(addr);
215214

216215
pfn = page_to_pfn(virt_to_page((void *)addr));

0 commit comments

Comments
 (0)