From bd3629e4e6fe8d5ef958031178c22829c93d1491 Mon Sep 17 00:00:00 2001 From: Andreas Eversberg Date: Sat, 25 Jun 2011 22:46:24 +0200 Subject: fw/l1a: Add a message to safely count the length of a txqueue (that is by locking) Written-by: Andreas Eversberg Signed-off-by: Sylvain Munaut --- src/target/firmware/layer1/async.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/target/firmware/layer1') diff --git a/src/target/firmware/layer1/async.c b/src/target/firmware/layer1/async.c index e5c80c7c..c07b0b5a 100644 --- a/src/target/firmware/layer1/async.c +++ b/src/target/firmware/layer1/async.c @@ -59,6 +59,21 @@ void l1a_meas_msgb_set(struct msgb *msg) local_irq_restore(flags); } +/* safely count messages in the L1S TX queue */ +int l1a_txq_msgb_count(struct llist_head *queue) +{ + unsigned long flags; + int num = 0; + struct llist_head *le; + + local_firq_save(flags); + llist_for_each(le, queue) + num++; + local_irq_restore(flags); + + return num; +} + /* safely flush all pending msgb */ void l1a_txq_msgb_flush(struct llist_head *queue) { -- cgit v1.2.3