Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 329772
b: refs/heads/master
c: 099a3f3
h: refs/heads/master
v: v3
  • Loading branch information
Sjur Brændeland authored and Ohad Ben-Cohen committed Sep 18, 2012
1 parent dd7a518 commit 1d0c5ae
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 2e37abb89a2ef13c524b0728bb9893f996a10b6b
refs/heads/master: 099a3f33c82b5153a4422eb92c648098b3f7c086
15 changes: 15 additions & 0 deletions trunk/drivers/remoteproc/remoteproc_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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;
}

/**
Expand Down
2 changes: 2 additions & 0 deletions trunk/include/linux/remoteproc.h
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,7 @@ enum rproc_crash_type {
* @crash_cnt: crash counter
* @crash_comp: completion used to sync crash handler and the rproc reload
* @recovery_disabled: flag that state if recovery was disabled
* @max_notifyid: largest allocated notify id.
*/
struct rproc {
struct klist_node node;
Expand Down Expand Up @@ -427,6 +428,7 @@ struct rproc {
unsigned crash_cnt;
struct completion crash_comp;
bool recovery_disabled;
int max_notifyid;
};

/* we currently support only two vrings per rvdev */
Expand Down

0 comments on commit 1d0c5ae

Please sign in to comment.