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

Commit 9e2b9b27 authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "BACKPORT: dma-buf: Move dma_buf_release() from fops to dentry_ops"

parents d093d671 96e6fb81
Loading
Loading
Loading
Loading
+22 −27
Original line number Original line Diff line number Diff line
@@ -102,35 +102,12 @@ static char *dmabuffs_dname(struct dentry *dentry, char *buffer, int buflen)
			     dentry->d_name.name, ret > 0 ? name : "");
			     dentry->d_name.name, ret > 0 ? name : "");
}
}


static const struct dentry_operations dma_buf_dentry_ops = {
static void dma_buf_release(struct dentry *dentry)
	.d_dname = dmabuffs_dname,
};

static struct vfsmount *dma_buf_mnt;

static struct dentry *dma_buf_fs_mount(struct file_system_type *fs_type,
		int flags, const char *name, void *data)
{
	return mount_pseudo(fs_type, "dmabuf:", NULL, &dma_buf_dentry_ops,
			DMA_BUF_MAGIC);
}

static struct file_system_type dma_buf_fs_type = {
	.name = "dmabuf",
	.mount = dma_buf_fs_mount,
	.kill_sb = kill_anon_super,
};

static int dma_buf_release(struct inode *inode, struct file *file)
{
{
	struct dma_buf *dmabuf;
	struct dma_buf *dmabuf;
	struct dentry *dentry = file->f_path.dentry;
	int dtor_ret = 0;
	int dtor_ret = 0;


	if (!is_dma_buf_file(file))
	dmabuf = dentry->d_fsdata;
		return -EINVAL;

	dmabuf = file->private_data;


	spin_lock(&dentry->d_lock);
	spin_lock(&dentry->d_lock);
	dentry->d_fsdata = NULL;
	dentry->d_fsdata = NULL;
@@ -167,9 +144,28 @@ static int dma_buf_release(struct inode *inode, struct file *file)


	module_put(dmabuf->owner);
	module_put(dmabuf->owner);
	dmabuf_dent_put(dmabuf);
	dmabuf_dent_put(dmabuf);
	return 0;
}
}


static const struct dentry_operations dma_buf_dentry_ops = {
	.d_dname = dmabuffs_dname,
	.d_release = dma_buf_release,
};

static struct vfsmount *dma_buf_mnt;

static struct dentry *dma_buf_fs_mount(struct file_system_type *fs_type,
		int flags, const char *name, void *data)
{
	return mount_pseudo(fs_type, "dmabuf:", NULL, &dma_buf_dentry_ops,
			DMA_BUF_MAGIC);
}

static struct file_system_type dma_buf_fs_type = {
	.name = "dmabuf",
	.mount = dma_buf_fs_mount,
	.kill_sb = kill_anon_super,
};

static int dma_buf_mmap_internal(struct file *file, struct vm_area_struct *vma)
static int dma_buf_mmap_internal(struct file *file, struct vm_area_struct *vma)
{
{
	struct dma_buf *dmabuf;
	struct dma_buf *dmabuf;
@@ -488,7 +484,6 @@ static void dma_buf_show_fdinfo(struct seq_file *m, struct file *file)
}
}


static const struct file_operations dma_buf_fops = {
static const struct file_operations dma_buf_fops = {
	.release	= dma_buf_release,
	.mmap		= dma_buf_mmap_internal,
	.mmap		= dma_buf_mmap_internal,
	.llseek		= dma_buf_llseek,
	.llseek		= dma_buf_llseek,
	.poll		= dma_buf_poll,
	.poll		= dma_buf_poll,