gpu: ion: Only flush buffers in the chunk heap if they were used cached
authorRebecca Schultz Zavin <rebecca@android.com>
Fri, 13 Dec 2013 22:24:33 +0000 (14:24 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 14 Dec 2013 16:55:41 +0000 (08:55 -0800)
Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
[jstultz: modified patch to apply to staging directory]
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/android/ion/ion_chunk_heap.c

index 558290989fe6b621cbbab188619e81a713e2557e..60cd91ca20711e2753c936a760783a4f1bcd3cfe 100644 (file)
@@ -104,8 +104,9 @@ static void ion_chunk_heap_free(struct ion_buffer *buffer)
        ion_heap_buffer_zero(buffer);
 
        for_each_sg(table->sgl, sg, table->nents, i) {
-               __dma_page_cpu_to_dev(sg_page(sg), 0, sg_dma_len(sg),
-                                     DMA_BIDIRECTIONAL);
+               if (ion_buffer_cached(buffer))
+                       __dma_page_cpu_to_dev(sg_page(sg), 0, sg_dma_len(sg),
+                                             DMA_BIDIRECTIONAL);
                gen_pool_free(chunk_heap->pool, page_to_phys(sg_page(sg)),
                              sg_dma_len(sg));
        }