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

Commit 5602508b authored by Tingwei Zhang's avatar Tingwei Zhang
Browse files

trace: ipc_logging: Convert to debugfs_file_get() and -put()



Convert all calls to the now obsolete debugfs_use_file_start()
and debugfs_use_file_finish() from ipc_logging to the new
debugfs_file_get() and debugfs_file_put() API.

Change-Id: I83781f97cd5ee5d441a915afb1d235427c206003
Signed-off-by: default avatarTingwei Zhang <tingwei@codeaurora.org>
parent f6ba3d45
Loading
Loading
Loading
Loading
+12 −15
Original line number Diff line number Diff line
@@ -78,17 +78,16 @@ static ssize_t debug_read_helper(struct file *file, char __user *buff,
	struct dentry *d = file->f_path.dentry;
	char *buffer;
	int bsize;
	int srcu_idx;
	int r;

	r = debugfs_use_file_start(d, &srcu_idx);
	r = debugfs_file_get(d);
	if (!r) {
		ilctxt = file->private_data;
		r = kref_get_unless_zero(&ilctxt->refcount) ? 0 : -EIO;
	}
	debugfs_use_file_finish(srcu_idx);
	if (r)
	} else {
		return r;
	}
	debugfs_file_put(d);

	buffer = kmalloc(count, GFP_KERNEL);
	if (!buffer) {
@@ -119,18 +118,17 @@ static ssize_t debug_write_ctrl(struct file *file, const char __user *buff,
	struct ipc_log_context *ilctxt;
	struct dentry *d = file->f_path.dentry;
	int bsize = 1;
	int srcu_idx;
	int r;
	char local_buf[3];

	r = debugfs_use_file_start(d, &srcu_idx);
	r = debugfs_file_get(d);
	if (!r) {
		ilctxt = file->private_data;
		r = kref_get_unless_zero(&ilctxt->refcount) ? 0 : -EIO;
	}
	debugfs_use_file_finish(srcu_idx);
	if (r)
	} else {
		return r;
	}
	debugfs_file_put(d);

	if (copy_from_user(local_buf, buff, bsize)) {
		count = -EFAULT;
@@ -172,17 +170,16 @@ static ssize_t debug_read_ctrl(struct file *file, char __user *buff,
	struct ipc_log_context *ilctxt;
	struct dentry *d = file->f_path.dentry;
	int bsize = 2;
	int srcu_idx;
	int r;

	r = debugfs_use_file_start(d, &srcu_idx);
	r = debugfs_file_get(d);
	if (!r) {
		ilctxt = file->private_data;
		r = kref_get_unless_zero(&ilctxt->refcount) ? 0 : -EIO;
	}
	debugfs_use_file_finish(srcu_idx);
	if (r)
	} else {
		return r;
	}
	debugfs_file_put(d);

	bsize = simple_read_from_buffer(buff, count, ppos,
				ilctxt->disabled?"1\n":"0\n", bsize);