Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 81ea2637 authored by Ivaylo Georgiev's avatar Ivaylo Georgiev
Browse files

dma-buf: Refactor dma-buf name



Replace 'name' with 'buf_name' in dma_buf as the same variable name
will be used by bf93f26d("UPSTREAM: dma-buf: add DMA_BUF_SET_NAME ioctls").

Change-Id: I1196e4c93bfe7fcfc15e2b2e83ed30807c84d2fb
Signed-off-by: default avatarIvaylo Georgiev <irgeorgiev@codeaurora.org>
parent 6a67f069
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -99,7 +99,7 @@ static int dma_buf_release(struct inode *inode, struct file *file)
		dmabuf->ops->release(dmabuf);
	else
		pr_warn_ratelimited("Leaking dmabuf %s because destructor failed error:%d\n",
				    dmabuf->name, dtor_ret);
				    dmabuf->buf_name, dtor_ret);

	dma_buf_ref_destroy(dmabuf);

@@ -107,7 +107,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;
}
@@ -482,7 +482,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) {
@@ -1194,7 +1194,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) {
@@ -1303,7 +1303,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);
	}
+3 −3
Original line number Diff line number Diff line
@@ -25,7 +25,7 @@ void print_internal_buffer(u32 tag, const char *str,
		dprintk(tag,
		"%s: %x : idx %2d fd %d off %d %s size %d flags %#x iova %#x",
		str, hash32_ptr(inst->session), cbuf->buf.index, cbuf->buf.fd,
		cbuf->buf.offset, cbuf->smem.dma_buf->name, cbuf->buf.size,
		cbuf->buf.offset, cbuf->smem.dma_buf->buf_name, cbuf->buf.size,
		cbuf->buf.flags, cbuf->smem.device_addr);
	} else {
		dprintk(tag,
@@ -438,7 +438,7 @@ static int msm_cvp_map_buf_user_persist(struct msm_cvp_inst *inst,

	dprintk(CVP_DBG,
	"%s: %x : fd %d %s size %d", "map persist", hash32_ptr(inst->session),
	cbuf->smem.fd, cbuf->smem.dma_buf->name, cbuf->smem.size);
	cbuf->smem.fd, cbuf->smem.dma_buf->buf_name, cbuf->smem.size);
	return rc;

exit:
@@ -2336,7 +2336,7 @@ int msm_cvp_session_deinit(struct msm_cvp_inst *inst)
				"remove from frame list",
				hash32_ptr(inst->session),
				buf->fd, buf->offset, buf->size,
				buf->dbuf->name);
				buf->dbuf->buf_name);

			list_del(&frame_buf->list);
			kmem_cache_free(cvp_driver->frame_buf_cache,
+4 −3
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (c) 2018-2019, The Linux Foundation. All rights reserved.
 * Copyright (c) 2018-2020, The Linux Foundation. All rights reserved.
 */

#include <linux/jiffies.h>
@@ -1825,13 +1825,14 @@ int cvp_comm_release_persist_buffers(struct msm_cvp_inst *inst)
			dprintk(CVP_DBG,
			"%s: %x : fd %d %s size %d",
			"free arp", hash32_ptr(inst->session), buf->smem.fd,
			buf->smem.dma_buf->name, buf->smem.size);
			buf->smem.dma_buf->buf_name, buf->smem.size);
			msm_cvp_smem_free(handle);
		} else if (buf->buffer_ownership == CLIENT) {
			dprintk(CVP_DBG,
			"%s: %x : fd %d %s size %d",
			"unmap persist", hash32_ptr(inst->session),
			buf->smem.fd, buf->smem.dma_buf->name, buf->smem.size);
			buf->smem.fd, buf->smem.dma_buf->buf_name,
			buf->smem.size);
			msm_cvp_smem_unmap_dma_buf(inst, &buf->smem);
		}

+47 −36
Original line number Diff line number Diff line
@@ -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.
 *
 */

@@ -334,14 +334,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,
@@ -383,14 +383,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,
@@ -635,7 +635,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);
@@ -644,8 +644,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;
	}
@@ -665,12 +665,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);
@@ -683,7 +685,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);
@@ -701,14 +703,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;
		}
@@ -728,7 +731,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);
@@ -737,7 +740,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;
@@ -757,12 +760,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);
@@ -774,7 +778,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);
@@ -791,12 +795,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;
@@ -842,7 +848,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);
@@ -851,8 +857,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;
	}
@@ -866,11 +872,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);
@@ -882,7 +890,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);
@@ -894,12 +902,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;
@@ -921,7 +929,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);
@@ -930,7 +938,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;
@@ -945,11 +953,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);

@@ -962,7 +971,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);
@@ -973,12 +982,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;
+2 −2
Original line number Diff line number Diff line
@@ -393,7 +393,7 @@ typedef int (*dma_buf_destructor)(struct dma_buf *dmabuf, void *dtor_data);
 * @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.
@@ -422,7 +422,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;