[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1358347430-9243-12-git-send-email-sjur.brandeland@stericsson.com>
Date: Wed, 16 Jan 2013 15:43:50 +0100
From: sjur.brandeland@...ricsson.com
To: Ido Yariv <ido@...ery.com>, Ohad Ben-Cohen <ohad@...ery.com>
Cc: mporter@...com,
Sjur Brændeland <sjurbren@...il.com>,
linux-kernel@...r.kernel.org,
Linus Walleij <linus.walleij@...aro.org>,
Loic Pallardy <loic.pallardy@...ricsson.com>,
Ludovic BARRE <ludovic.barre@...ricsson.com>,
Fernando Guzman Lugo <fernando.lugo@...com>,
Suman Anna <s-anna@...com>, Mark Grosen <mgrosen@...com>,
Stephen Boyd <sboyd@...eaurora.org>,
Sjur Brændeland <sjur.brandeland@...ricsson.com>
Subject: [RFCv3 11/11] remoteproc: Calculate max_notifyid by counting vrings
From: Sjur Brændeland <sjur.brandeland@...ricsson.com>
Simplify hanling of max_notifyid by simply counting the
number of vrings.
Signed-off-by: Sjur Brændeland <sjur.brandeland@...ricsson.com>
---
drivers/remoteproc/remoteproc_core.c | 20 +++++---------------
1 files changed, 5 insertions(+), 15 deletions(-)
diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c
index 4f342e0..31ecb30 100644
--- a/drivers/remoteproc/remoteproc_core.c
+++ b/drivers/remoteproc/remoteproc_core.c
@@ -227,9 +227,6 @@ 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 %llx size %x idr %d\n", i, va,
(unsigned long long)dma, size, notifyid);
@@ -279,25 +276,13 @@ 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;
}
/**
@@ -372,6 +357,9 @@ static int rproc_handle_vdev(struct rproc *rproc, struct fw_rsc_vdev *rsc,
/* remember the resource entry */
rvdev->rsc = rsc;
+ /* Summerize the number of notification IDs */
+ rproc->max_notifyid += rsc->num_of_vrings;
+
list_add_tail(&rvdev->node, &rproc->rvdevs);
/* it is now safe to add the virtio device */
@@ -827,6 +815,8 @@ static void rproc_fw_load(const struct firmware *fw, void *context)
goto clean_up;
}
+ rproc->max_notifyid = 0;
+
/* handle fw resources which are required to load rproc */
ret = rproc_handle_resource(rproc, table, tablesz, rproc_handle_rsc);
if (ret) {
--
1.7.5.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists