dma-buf: refactor dma-buf name

rename 'name' to 'buf_name' in dma_buf since 'name' will be used
by the user specified name in upstream commit
"UPSTREAM: dma-buf: add DMA_BUF_SET_NAME ioctls".

Change-Id: I70e20bdb71e964d1da240b1d0323b26bb89d0ddc
Signed-off-by: Srinivasarao P <spathi@codeaurora.org>
This commit is contained in:
Srinivasarao P 2020-01-31 15:57:17 +05:30 committed by Blagovest Kolenichev
parent 3c563a8a9e
commit 00a53a392d
3 changed files with 53 additions and 42 deletions

View File

@ -99,7 +99,7 @@ static int dma_buf_release(struct inode *inode, struct file *file)
reservation_object_fini(dmabuf->resv);
module_put(dmabuf->owner);
kfree(dmabuf->name);
kfree(dmabuf->buf_name);
kfree(dmabuf);
return 0;
}
@ -475,7 +475,7 @@ struct dma_buf *dma_buf_export(const struct dma_buf_export_info *exp_info)
init_waitqueue_head(&dmabuf->poll);
dmabuf->cb_excl.poll = dmabuf->cb_shared.poll = &dmabuf->poll;
dmabuf->cb_excl.active = dmabuf->cb_shared.active = 0;
dmabuf->name = bufname;
dmabuf->buf_name = bufname;
dmabuf->ktime = ktime_get();
if (!resv) {
@ -1232,7 +1232,7 @@ static int dma_buf_debug_show(struct seq_file *s, void *unused)
buf_obj->size,
buf_obj->file->f_flags, buf_obj->file->f_mode,
file_count(buf_obj->file),
buf_obj->exp_name, buf_obj->name);
buf_obj->exp_name, buf_obj->buf_name);
robj = buf_obj->resv;
while (true) {
@ -1341,7 +1341,7 @@ static void write_proc(struct seq_file *s, struct dma_proc *proc)
elapmstime = ktime_divns(elapmstime, MSEC_PER_SEC);
seq_printf(s, "%-8s\t%-8ld\t%-8lld\n",
dmabuf->name,
dmabuf->buf_name,
dmabuf->size / SZ_1K,
elapmstime);
}

View File

@ -3,7 +3,7 @@
* drivers/staging/android/ion/ion.c
*
* Copyright (C) 2011 Google, Inc.
* Copyright (c) 2011-2019, The Linux Foundation. All rights reserved.
* Copyright (c) 2011-2020, The Linux Foundation. All rights reserved.
*
* This software is licensed under the terms of the GNU General Public
* License version 2, as published by the Free Software Foundation, and
@ -347,14 +347,14 @@ static struct sg_table *ion_map_dma_buf(struct dma_buf_attachment *attachment,
mutex_lock(&buffer->lock);
if (map_attrs & DMA_ATTR_SKIP_CPU_SYNC)
trace_ion_dma_map_cmo_skip(attachment->dev,
attachment->dmabuf->name,
attachment->dmabuf->buf_name,
ion_buffer_cached(buffer),
hlos_accessible_buffer(buffer),
attachment->dma_map_attrs,
direction);
else
trace_ion_dma_map_cmo_apply(attachment->dev,
attachment->dmabuf->name,
attachment->dmabuf->buf_name,
ion_buffer_cached(buffer),
hlos_accessible_buffer(buffer),
attachment->dma_map_attrs,
@ -396,14 +396,14 @@ static void ion_unmap_dma_buf(struct dma_buf_attachment *attachment,
mutex_lock(&buffer->lock);
if (map_attrs & DMA_ATTR_SKIP_CPU_SYNC)
trace_ion_dma_unmap_cmo_skip(attachment->dev,
attachment->dmabuf->name,
attachment->dmabuf->buf_name,
ion_buffer_cached(buffer),
hlos_accessible_buffer(buffer),
attachment->dma_map_attrs,
direction);
else
trace_ion_dma_unmap_cmo_apply(attachment->dev,
attachment->dmabuf->name,
attachment->dmabuf->buf_name,
ion_buffer_cached(buffer),
hlos_accessible_buffer(buffer),
attachment->dma_map_attrs,
@ -650,7 +650,7 @@ static int __ion_dma_buf_begin_cpu_access(struct dma_buf *dmabuf,
int ret = 0;
if (!hlos_accessible_buffer(buffer)) {
trace_ion_begin_cpu_access_cmo_skip(NULL, dmabuf->name,
trace_ion_begin_cpu_access_cmo_skip(NULL, dmabuf->buf_name,
ion_buffer_cached(buffer),
false, direction,
sync_only_mapped);
@ -659,8 +659,8 @@ static int __ion_dma_buf_begin_cpu_access(struct dma_buf *dmabuf,
}
if (!(buffer->flags & ION_FLAG_CACHED)) {
trace_ion_begin_cpu_access_cmo_skip(NULL, dmabuf->name, false,
true, direction,
trace_ion_begin_cpu_access_cmo_skip(NULL, dmabuf->buf_name,
false, true, direction,
sync_only_mapped);
goto out;
}
@ -680,12 +680,14 @@ static int __ion_dma_buf_begin_cpu_access(struct dma_buf *dmabuf,
table->nents, direction);
if (!ret)
trace_ion_begin_cpu_access_cmo_apply(dev, dmabuf->name,
trace_ion_begin_cpu_access_cmo_apply(dev,
dmabuf->buf_name,
true, true,
direction,
sync_only_mapped);
else
trace_ion_begin_cpu_access_cmo_skip(dev, dmabuf->name,
trace_ion_begin_cpu_access_cmo_skip(dev,
dmabuf->buf_name,
true, true,
direction,
sync_only_mapped);
@ -698,7 +700,7 @@ static int __ion_dma_buf_begin_cpu_access(struct dma_buf *dmabuf,
if (!a->dma_mapped) {
trace_ion_begin_cpu_access_notmapped(a->dev,
dmabuf->name,
dmabuf->buf_name,
true, true,
direction,
sync_only_mapped);
@ -716,14 +718,15 @@ static int __ion_dma_buf_begin_cpu_access(struct dma_buf *dmabuf,
if (!tmp) {
trace_ion_begin_cpu_access_cmo_apply(a->dev,
dmabuf->name,
dmabuf->buf_name,
true, true,
direction,
sync_only_mapped);
} else {
trace_ion_begin_cpu_access_cmo_skip(a->dev,
dmabuf->name, true,
true, direction,
dmabuf->buf_name,
true, true,
direction,
sync_only_mapped);
ret = tmp;
}
@ -744,7 +747,7 @@ static int __ion_dma_buf_end_cpu_access(struct dma_buf *dmabuf,
int ret = 0;
if (!hlos_accessible_buffer(buffer)) {
trace_ion_end_cpu_access_cmo_skip(NULL, dmabuf->name,
trace_ion_end_cpu_access_cmo_skip(NULL, dmabuf->buf_name,
ion_buffer_cached(buffer),
false, direction,
sync_only_mapped);
@ -753,7 +756,7 @@ static int __ion_dma_buf_end_cpu_access(struct dma_buf *dmabuf,
}
if (!(buffer->flags & ION_FLAG_CACHED)) {
trace_ion_end_cpu_access_cmo_skip(NULL, dmabuf->name, false,
trace_ion_end_cpu_access_cmo_skip(NULL, dmabuf->buf_name, false,
true, direction,
sync_only_mapped);
goto out;
@ -773,12 +776,13 @@ static int __ion_dma_buf_end_cpu_access(struct dma_buf *dmabuf,
table->nents, direction);
if (!ret)
trace_ion_end_cpu_access_cmo_apply(dev, dmabuf->name,
trace_ion_end_cpu_access_cmo_apply(dev,
dmabuf->buf_name,
true, true,
direction,
sync_only_mapped);
else
trace_ion_end_cpu_access_cmo_skip(dev, dmabuf->name,
trace_ion_end_cpu_access_cmo_skip(dev, dmabuf->buf_name,
true, true, direction,
sync_only_mapped);
mutex_unlock(&buffer->lock);
@ -790,7 +794,7 @@ static int __ion_dma_buf_end_cpu_access(struct dma_buf *dmabuf,
if (!a->dma_mapped) {
trace_ion_end_cpu_access_notmapped(a->dev,
dmabuf->name,
dmabuf->buf_name,
true, true,
direction,
sync_only_mapped);
@ -807,12 +811,14 @@ static int __ion_dma_buf_end_cpu_access(struct dma_buf *dmabuf,
a->table->nents, direction);
if (!tmp) {
trace_ion_end_cpu_access_cmo_apply(a->dev, dmabuf->name,
trace_ion_end_cpu_access_cmo_apply(a->dev,
dmabuf->buf_name,
true, true,
direction,
sync_only_mapped);
} else {
trace_ion_end_cpu_access_cmo_skip(a->dev, dmabuf->name,
trace_ion_end_cpu_access_cmo_skip(a->dev,
dmabuf->buf_name,
true, true, direction,
sync_only_mapped);
ret = tmp;
@ -858,7 +864,7 @@ static int ion_dma_buf_begin_cpu_access_partial(struct dma_buf *dmabuf,
int ret = 0;
if (!hlos_accessible_buffer(buffer)) {
trace_ion_begin_cpu_access_cmo_skip(NULL, dmabuf->name,
trace_ion_begin_cpu_access_cmo_skip(NULL, dmabuf->buf_name,
ion_buffer_cached(buffer),
false, dir,
false);
@ -867,8 +873,8 @@ static int ion_dma_buf_begin_cpu_access_partial(struct dma_buf *dmabuf,
}
if (!(buffer->flags & ION_FLAG_CACHED)) {
trace_ion_begin_cpu_access_cmo_skip(NULL, dmabuf->name, false,
true, dir,
trace_ion_begin_cpu_access_cmo_skip(NULL, dmabuf->buf_name,
false, true, dir,
false);
goto out;
}
@ -882,11 +888,13 @@ static int ion_dma_buf_begin_cpu_access_partial(struct dma_buf *dmabuf,
offset, len, dir, true);
if (!ret)
trace_ion_begin_cpu_access_cmo_apply(dev, dmabuf->name,
trace_ion_begin_cpu_access_cmo_apply(dev,
dmabuf->buf_name,
true, true, dir,
false);
else
trace_ion_begin_cpu_access_cmo_skip(dev, dmabuf->name,
trace_ion_begin_cpu_access_cmo_skip(dev,
dmabuf->buf_name,
true, true, dir,
false);
mutex_unlock(&buffer->lock);
@ -898,7 +906,7 @@ static int ion_dma_buf_begin_cpu_access_partial(struct dma_buf *dmabuf,
if (!a->dma_mapped) {
trace_ion_begin_cpu_access_notmapped(a->dev,
dmabuf->name,
dmabuf->buf_name,
true, true,
dir,
false);
@ -910,12 +918,12 @@ static int ion_dma_buf_begin_cpu_access_partial(struct dma_buf *dmabuf,
if (!tmp) {
trace_ion_begin_cpu_access_cmo_apply(a->dev,
dmabuf->name,
dmabuf->buf_name,
true, true, dir,
false);
} else {
trace_ion_begin_cpu_access_cmo_skip(a->dev,
dmabuf->name,
dmabuf->buf_name,
true, true, dir,
false);
ret = tmp;
@ -938,7 +946,7 @@ static int ion_dma_buf_end_cpu_access_partial(struct dma_buf *dmabuf,
int ret = 0;
if (!hlos_accessible_buffer(buffer)) {
trace_ion_end_cpu_access_cmo_skip(NULL, dmabuf->name,
trace_ion_end_cpu_access_cmo_skip(NULL, dmabuf->buf_name,
ion_buffer_cached(buffer),
false, direction,
false);
@ -947,7 +955,7 @@ static int ion_dma_buf_end_cpu_access_partial(struct dma_buf *dmabuf,
}
if (!(buffer->flags & ION_FLAG_CACHED)) {
trace_ion_end_cpu_access_cmo_skip(NULL, dmabuf->name, false,
trace_ion_end_cpu_access_cmo_skip(NULL, dmabuf->buf_name, false,
true, direction,
false);
goto out;
@ -962,11 +970,12 @@ static int ion_dma_buf_end_cpu_access_partial(struct dma_buf *dmabuf,
offset, len, direction, false);
if (!ret)
trace_ion_end_cpu_access_cmo_apply(dev, dmabuf->name,
trace_ion_end_cpu_access_cmo_apply(dev,
dmabuf->buf_name,
true, true,
direction, false);
else
trace_ion_end_cpu_access_cmo_skip(dev, dmabuf->name,
trace_ion_end_cpu_access_cmo_skip(dev, dmabuf->buf_name,
true, true,
direction, false);
@ -979,7 +988,7 @@ static int ion_dma_buf_end_cpu_access_partial(struct dma_buf *dmabuf,
if (!a->dma_mapped) {
trace_ion_end_cpu_access_notmapped(a->dev,
dmabuf->name,
dmabuf->buf_name,
true, true,
direction,
false);
@ -990,12 +999,14 @@ static int ion_dma_buf_end_cpu_access_partial(struct dma_buf *dmabuf,
offset, len, direction, false);
if (!tmp) {
trace_ion_end_cpu_access_cmo_apply(a->dev, dmabuf->name,
trace_ion_end_cpu_access_cmo_apply(a->dev,
dmabuf->buf_name,
true, true,
direction, false);
} else {
trace_ion_end_cpu_access_cmo_skip(a->dev, dmabuf->name,
trace_ion_end_cpu_access_cmo_skip(a->dev,
dmabuf->buf_name,
true, true, direction,
false);
ret = tmp;

View File

@ -383,7 +383,7 @@ struct dma_buf_ops {
* @vmapping_counter: used internally to refcnt the vmaps
* @vmap_ptr: the current vmap ptr if vmapping_counter > 0
* @exp_name: name of the exporter; useful for debugging.
* @name: unique name for the buffer
* @buf_name: unique name for the buffer
* @ktime: time (in jiffies) at which the buffer was born
* @owner: pointer to exporter module; used for refcounting when exporter is a
* kernel module.
@ -412,7 +412,7 @@ struct dma_buf {
unsigned vmapping_counter;
void *vmap_ptr;
const char *exp_name;
char *name;
char *buf_name;
ktime_t ktime;
struct module *owner;
struct list_head list_node;