Re: [PATCH] staging: android: ion: Skip sync if not mapped
From: Dan Carpenter
Date: Thu Apr 16 2020 - 05:53:22 EST
On Tue, Apr 14, 2020 at 04:18:47PM +0200, Ørjan Eide wrote:
> @@ -238,6 +242,10 @@ static void ion_unmap_dma_buf(struct dma_buf_attachment *attachment,
> struct sg_table *table,
> enum dma_data_direction direction)
> {
> + struct ion_dma_buf_attachment *a = attachment->priv;
> +
> + a->mapped = false;
Possibly a stupid question but here we're not holding a lock. Is
concurrency an issue?
> +
> dma_unmap_sg(attachment->dev, table->sgl, table->nents, direction);
> }
>
> @@ -297,6 +305,8 @@ static int ion_dma_buf_begin_cpu_access(struct dma_buf *dmabuf,
>
> mutex_lock(&buffer->lock);
> list_for_each_entry(a, &buffer->attachments, list) {
> + if (!a->mapped)
> + continue;
> dma_sync_sg_for_cpu(a->dev, a->table->sgl, a->table->nents,
> direction);
> }
regards,
dan carpenter