Merge "msm: adsprpc: store process specific info in GETINFO ioctl call"
diff --git a/drivers/char/adsprpc.c b/drivers/char/adsprpc.c
index 9033c23..a0652b7 100644
--- a/drivers/char/adsprpc.c
+++ b/drivers/char/adsprpc.c
@@ -3484,11 +3484,8 @@
static int fastrpc_device_open(struct inode *inode, struct file *filp)
{
int err = 0;
- struct dentry *debugfs_file;
struct fastrpc_file *fl = NULL;
struct fastrpc_apps *me = &gfa;
- char strpid[PID_SIZE];
- int buf_size = 0;
/*
* Indicates the device node opened
@@ -3506,13 +3503,6 @@
VERIFY(err, NULL != (fl = kzalloc(sizeof(*fl), GFP_KERNEL)));
if (err)
return err;
- snprintf(strpid, PID_SIZE, "%d", current->pid);
- buf_size = strlen(current->comm) + strlen("_") + strlen(strpid) + 1;
- fl->debug_buf = kzalloc(buf_size, GFP_KERNEL);
- snprintf(fl->debug_buf, UL_SIZE, "%.10s%s%d",
- current->comm, "_", current->pid);
- debugfs_file = debugfs_create_file(fl->debug_buf, 0644,
- debugfs_root, fl, &debugfs_fops);
context_list_ctor(&fl->clst);
spin_lock_init(&fl->hlock);
@@ -3522,14 +3512,11 @@
INIT_HLIST_HEAD(&fl->remote_bufs);
INIT_HLIST_NODE(&fl->hn);
fl->sessionid = 0;
- fl->tgid = current->tgid;
fl->apps = me;
fl->mode = FASTRPC_MODE_SERIAL;
fl->cid = -1;
fl->dev_minor = dev_minor;
fl->init_mem = NULL;
- if (debugfs_file != NULL)
- fl->debugfs_file = debugfs_file;
fl->qos_request = 0;
fl->refcount = 0;
filp->private_data = fl;
@@ -3542,6 +3529,29 @@
return 0;
}
+static int fastrpc_set_process_info(struct fastrpc_file *fl)
+{
+ int err = 0, buf_size = 0;
+ char strpid[PID_SIZE];
+
+ fl->tgid = current->tgid;
+ snprintf(strpid, PID_SIZE, "%d", current->pid);
+ buf_size = strlen(current->comm) + strlen("_") + strlen(strpid) + 1;
+ fl->debug_buf = kzalloc(buf_size, GFP_KERNEL);
+ if (!fl->debug_buf) {
+ err = -ENOMEM;
+ return err;
+ }
+ snprintf(fl->debug_buf, UL_SIZE, "%.10s%s%d",
+ current->comm, "_", current->pid);
+ fl->debugfs_file = debugfs_create_file(fl->debug_buf, 0644,
+ debugfs_root, fl, &debugfs_fops);
+ if (!fl->debugfs_file)
+ pr_warn("Error: %s: %s: failed to create debugfs file %s\n",
+ current->comm, __func__, fl->debug_buf);
+ return err;
+}
+
static int fastrpc_get_info(struct fastrpc_file *fl, uint32_t *info)
{
int err = 0;
@@ -3550,6 +3560,9 @@
VERIFY(err, fl != NULL);
if (err)
goto bail;
+ err = fastrpc_set_process_info(fl);
+ if (err)
+ goto bail;
if (fl->cid == -1) {
cid = *info;
VERIFY(err, cid < NUM_CHANNELS);