aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/remoteproc
diff options
context:
space:
mode:
authorZiyann <jaraidaniel@gmail.com>2014-07-31 10:25:52 +0200
committerZiyann <jaraidaniel@gmail.com>2014-11-19 21:12:34 +0100
commitbd0d4e4c22a3ca10cb3db7caea83491d6eec446b (patch)
tree0f850f3bc82b355b098f05ce81205af524bd91a9 /drivers/remoteproc
parentf928822646fe28b6e547049d94115352657c2442 (diff)
downloadkernel_samsung_tuna-bd0d4e4c22a3ca10cb3db7caea83491d6eec446b.tar.gz
kernel_samsung_tuna-bd0d4e4c22a3ca10cb3db7caea83491d6eec446b.tar.bz2
kernel_samsung_tuna-bd0d4e4c22a3ca10cb3db7caea83491d6eec446b.zip
Revert "remoteproc: add mutex protection for traces"
This reverts commit 565e03c393854495e814342eb3138e21a3de2604. Conflicts: drivers/remoteproc/remoteproc.c
Diffstat (limited to 'drivers/remoteproc')
-rwxr-xr-xdrivers/remoteproc/remoteproc.c71
1 files changed, 23 insertions, 48 deletions
diff --git a/drivers/remoteproc/remoteproc.c b/drivers/remoteproc/remoteproc.c
index 8c122058ef5..1801f2b9b74 100755
--- a/drivers/remoteproc/remoteproc.c
+++ b/drivers/remoteproc/remoteproc.c
@@ -48,30 +48,22 @@ static DEFINE_SPINLOCK(rprocs_lock);
/* debugfs parent dir */
static struct dentry *rproc_dbg;
-static ssize_t rproc_format_trace_buf(struct rproc *rproc, char __user *userbuf,
- size_t count, loff_t *ppos,
- const void *src, int size)
+static ssize_t rproc_format_trace_buf(char __user *userbuf, size_t count,
+ loff_t *ppos, const void *src, int size)
{
const char *buf = (const char *) src;
ssize_t num_copied = 0;
static int from_beg;
loff_t pos = *ppos;
int *w_idx;
- int i, w_pos, ret = 0;
-
- if (mutex_lock_interruptible(&rproc->tlock))
- return -EINTR;
+ int i, w_pos;
/* When src is NULL, the remoteproc is offline. */
- if (!src) {
- ret = -EIO;
- goto unlock;
- }
+ if (!src)
+ return -EIO;
- if (size < 2 * sizeof(u32)) {
- ret = -EINVAL;
- goto unlock;
- }
+ if (size < 2 * sizeof(u32))
+ return -EINVAL;
/* Assume write_idx is the penultimate byte in the buffer trace*/
size = size - (sizeof(u32) * 2);
@@ -93,10 +85,8 @@ static ssize_t rproc_format_trace_buf(struct rproc *rproc, char __user *userbuf,
if (!num_copied) {
from_beg = 1;
*ppos = 0;
- } else {
- ret = num_copied;
- goto unlock;
- }
+ } else
+ return num_copied;
print_beg:
for (i = 0; i < w_pos && buf[i]; i++)
;
@@ -106,11 +96,9 @@ print_beg:
ppos, src, i);
if (!num_copied)
from_beg = 0;
- ret = num_copied;
+ return num_copied;
}
-unlock:
- mutex_unlock(&rproc->tlock);
- return ret;
+ return 0;
}
static ssize_t rproc_name_read(struct file *filp, char __user *userbuf,
@@ -147,12 +135,12 @@ static int rproc_open_generic(struct inode *inode, struct file *file)
return 0;
}
-#define DEBUGFS_READONLY_FILE(name, v, l) \
+#define DEBUGFS_READONLY_FILE(name, value, len) \
static ssize_t name## _rproc_read(struct file *filp, \
- char __user *ubuf, size_t count, loff_t *ppos) \
+ char __user *userbuf, size_t count, loff_t *ppos) \
{ \
struct rproc *rproc = filp->private_data; \
- return rproc_format_trace_buf(rproc, ubuf, count, ppos, v, l); \
+ return rproc_format_trace_buf(userbuf, count, ppos, value, len);\
} \
\
static const struct file_operations name ##_rproc_ops = { \
@@ -944,14 +932,10 @@ static int rproc_handle_resources(struct rproc *rproc, struct fw_resource *rsc,
* trace buffer memory _is_ normal memory, so we cast away the
* __iomem to make sparse happy
*/
-
- if (mutex_lock_interruptible(&rproc->tlock))
- goto error;
-
if (trace_da0) {
ret = rproc_da_to_pa(rproc, trace_da0, &pa);
if (ret)
- goto unlock;
+ goto error;
rproc->trace_buf0 = (__force void *)
ioremap_nocache(pa, rproc->trace_len0);
if (rproc->trace_buf0) {
@@ -962,20 +946,20 @@ static int rproc_handle_resources(struct rproc *rproc, struct fw_resource *rsc,
GFP_KERNEL);
if (!rproc->last_trace_buf0) {
ret = -ENOMEM;
- goto unlock;
+ goto error;
}
DEBUGFS_ADD(trace0_last);
}
} else {
dev_err(dev, "can't ioremap trace buffer0\n");
ret = -EIO;
- goto unlock;
+ goto error;
}
}
if (trace_da1) {
ret = rproc_da_to_pa(rproc, trace_da1, &pa);
if (ret)
- goto unlock;
+ goto error;
rproc->trace_buf1 = (__force void *)
ioremap_nocache(pa, rproc->trace_len1);
if (rproc->trace_buf1) {
@@ -986,14 +970,13 @@ static int rproc_handle_resources(struct rproc *rproc, struct fw_resource *rsc,
GFP_KERNEL);
if (!rproc->last_trace_buf1) {
ret = -ENOMEM;
- goto unlock;
+ goto error;
}
DEBUGFS_ADD(trace1_last);
}
} else {
dev_err(dev, "can't ioremap trace buffer1\n");
ret = -EIO;
- goto unlock;
}
}
@@ -1007,7 +990,7 @@ static int rproc_handle_resources(struct rproc *rproc, struct fw_resource *rsc,
if (cdump_da0) {
ret = rproc_da_to_pa(rproc, cdump_da0, &pa);
if (ret)
- goto unlock;
+ goto error;
rproc->cdump_buf0 = (__force void *)
ioremap_nocache(pa, rproc->cdump_len0);
if (rproc->cdump_buf0)
@@ -1015,13 +998,13 @@ static int rproc_handle_resources(struct rproc *rproc, struct fw_resource *rsc,
else {
dev_err(dev, "can't ioremap cdump buffer0\n");
ret = -EIO;
- goto unlock;
+ goto error;
}
}
if (cdump_da1) {
ret = rproc_da_to_pa(rproc, cdump_da1, &pa);
if (ret)
- goto unlock;
+ goto error;
rproc->cdump_buf1 = (__force void *)
ioremap_nocache(pa, rproc->cdump_len1);
if (rproc->cdump_buf1)
@@ -1029,12 +1012,10 @@ static int rproc_handle_resources(struct rproc *rproc, struct fw_resource *rsc,
else {
dev_err(dev, "can't ioremap cdump buffer1\n");
ret = -EIO;
+ goto error;
}
}
-unlock:
- mutex_unlock(&rproc->tlock);
-
error:
if (ret && rproc->dbg_dir) {
debugfs_remove_recursive(rproc->dbg_dir);
@@ -1391,9 +1372,6 @@ void rproc_put(struct rproc *rproc)
if (--rproc->count)
goto out;
- if (mutex_lock_interruptible(&rproc->tlock))
- goto out;
-
if (rproc->trace_buf0)
/* iounmap normal memory, so make sparse happy */
iounmap((__force void __iomem *) rproc->trace_buf0);
@@ -1410,8 +1388,6 @@ void rproc_put(struct rproc *rproc)
iounmap((__force void __iomem *) rproc->cdump_buf1);
rproc->cdump_buf0 = rproc->cdump_buf1 = NULL;
- mutex_unlock(&rproc->tlock);
-
rproc_reset_poolmem(rproc);
memset(rproc->memory_maps, 0, sizeof(rproc->memory_maps));
kfree(rproc->header);
@@ -1761,7 +1737,6 @@ int rproc_register(struct device *dev, const char *name,
#endif
mutex_init(&rproc->lock);
mutex_init(&rproc->secure_lock);
- mutex_init(&rproc->tlock);
INIT_WORK(&rproc->error_work, rproc_error_work);
BLOCKING_INIT_NOTIFIER_HEAD(&rproc->nbh);