Re: [PATCHv2] remoteproc: Export notification id range

From: Ohad Ben-Cohen
Date: Tue Sep 18 2012 - 00:23:49 EST


Hi Sjur,

On Thu, Sep 13, 2012 at 9:03 PM, <sjur.brandeland@xxxxxxxxxxxxxx> wrote:
> From: Sjur Brændeland <sjur.brandeland@xxxxxxxxxxxxxx>
>
> Some of the rproc drivers needs to know the range
> of the notification IDs used for notifying the device.
> Export a variable in struct rproc holding the
> largest allocated notification id.
>
> Signed-off-by: Sjur Brændeland <sjur.brandeland@xxxxxxxxxxxxxx>
> ---
...
> void rproc_free_vring(struct rproc_vring *rvring)
> {
> + int i, maxid = 0;
> + struct rproc_vdev *rvdev, *tmp;
> int size = PAGE_ALIGN(vring_size(rvring->len, rvring->align));
> struct rproc *rproc = rvring->rvdev->rproc;
>
> dma_free_coherent(rproc->dev.parent, size, rvring->va, rvring->dma);
> idr_remove(&rproc->notifyids, rvring->notifyid);
> +
> + /* Iterate over the new set of rings to find the largest id */
> + rvring->notifyid = 0;
> + list_for_each_entry_safe(rvdev, tmp, &rproc->rvdevs, node)

Why do you need the safe variant here ?

> + for (i = 0; i < RVDEV_NUM_VRINGS; i++)

Maybe instead of two nested loops, just use idr_for_each ?

Thanks,
Ohad.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/