summaryrefslogtreecommitdiffstats
path: root/drivers/remoteproc
diff options
context:
space:
mode:
authorSjur Brændeland <sjur.brandeland@stericsson.com>2012-09-18 20:32:45 +0200
committerOhad Ben-Cohen <ohad@wizery.com>2012-09-18 20:55:52 +0200
commit099a3f33c82b5153a4422eb92c648098b3f7c086 (patch)
treeceeb12f2321595dd465aac47873ab2497463a8b8 /drivers/remoteproc
parentremoteproc: create a 'recovery' debugfs entry (diff)
downloadlinux-099a3f33c82b5153a4422eb92c648098b3f7c086.tar.xz
linux-099a3f33c82b5153a4422eb92c648098b3f7c086.zip
remtoteproc: maintain max notifyid
Some of the rproc drivers (STE modem specifically) needs to know the range of the notification IDs used for notifying the device. Maintain a variable in struct rproc holding the largest allocated notification id, so low-level rproc drivers could access it. Signed-off-by: Sjur Brændeland <sjur.brandeland@stericsson.com> [ohad: rebase, slightly edit commit log] Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
Diffstat (limited to 'drivers/remoteproc')
-rw-r--r--drivers/remoteproc/remoteproc_core.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c
index 29fc8236cac9..b6c622982f8c 100644
--- a/drivers/remoteproc/remoteproc_core.c
+++ b/drivers/remoteproc/remoteproc_core.c
@@ -228,6 +228,9 @@ int rproc_alloc_vring(struct rproc_vdev *rvdev, int i)
return ret;
}
+ /* Store largest notifyid */
+ rproc->max_notifyid = max(rproc->max_notifyid, notifyid);
+
dev_dbg(dev, "vring%d: va %p dma %x size %x idr %d\n", i, va,
dma, size, notifyid);
@@ -269,13 +272,25 @@ rproc_parse_vring(struct rproc_vdev *rvdev, struct fw_rsc_vdev *rsc, int i)
return 0;
}
+static int rproc_max_notifyid(int id, void *p, void *data)
+{
+ int *maxid = data;
+ *maxid = max(*maxid, id);
+ return 0;
+}
+
void rproc_free_vring(struct rproc_vring *rvring)
{
int size = PAGE_ALIGN(vring_size(rvring->len, rvring->align));
struct rproc *rproc = rvring->rvdev->rproc;
+ int maxid = 0;
dma_free_coherent(rproc->dev.parent, size, rvring->va, rvring->dma);
idr_remove(&rproc->notifyids, rvring->notifyid);
+
+ /* Find the largest remaining notifyid */
+ idr_for_each(&rproc->notifyids, rproc_max_notifyid, &maxid);
+ rproc->max_notifyid = maxid;
}
/**