diff options
Diffstat (limited to 'kernel/ethosu_buffer.c')
-rw-r--r-- | kernel/ethosu_buffer.c | 28 |
1 files changed, 4 insertions, 24 deletions
diff --git a/kernel/ethosu_buffer.c b/kernel/ethosu_buffer.c index 0fcbf3b..fb4a8b4 100644 --- a/kernel/ethosu_buffer.c +++ b/kernel/ethosu_buffer.c @@ -62,24 +62,6 @@ static const struct file_operations ethosu_buffer_fops = { * Functions ****************************************************************************/ -__attribute__((used)) -static dma_addr_t ethosu_pa_to_da(struct device *dev, - phys_addr_t pa, - size_t len) -{ - struct rproc *rproc = rproc_get_by_child(dev); - struct rproc_mem_entry *mem; - - list_for_each_entry(mem, &rproc->carveouts, node) { - ssize_t offset = pa - mem->dma; - - if (offset >= 0 && offset + len <= mem->len) - return mem->da + offset; - } - - return (dma_addr_t)-1; -} - static bool ethosu_buffer_verify(struct file *file) { return file->f_op == ðosu_buffer_fops; @@ -90,11 +72,10 @@ static void ethosu_buffer_destroy(struct kref *kref) struct ethosu_buffer *buf = container_of(kref, struct ethosu_buffer, kref); struct device *dev = buf->dev; - struct rproc *rproc = rproc_get_by_child(dev); - dev_info(dev, "Buffer destroy. buf=0x%pK\n", buf); + dev_info(dev, "Buffer destroy. buf=0x%pK", buf); - dma_free_coherent(rproc->dev.parent, buf->capacity, buf->cpu_addr, + dma_free_coherent(dev, buf->capacity, buf->cpu_addr, buf->dma_addr); devm_kfree(dev, buf); @@ -192,7 +173,6 @@ static long ethosu_buffer_ioctl(struct file *file, int ethosu_buffer_create(struct device *dev, size_t capacity) { - struct rproc *rproc = rproc_get_by_child(dev); struct ethosu_buffer *buf; int ret = -ENOMEM; @@ -209,7 +189,7 @@ int ethosu_buffer_create(struct device *dev, buf->size = 0; kref_init(&buf->kref); - buf->cpu_addr = dma_alloc_coherent(rproc->dev.parent, capacity, + buf->cpu_addr = dma_alloc_coherent(dev, capacity, &buf->dma_addr, GFP_KERNEL); if (!buf->cpu_addr) goto free_buf; @@ -230,7 +210,7 @@ int ethosu_buffer_create(struct device *dev, return ret; free_dma: - dma_free_coherent(rproc->dev.parent, buf->capacity, buf->cpu_addr, + dma_free_coherent(dev, buf->capacity, buf->cpu_addr, buf->dma_addr); free_buf: |