|
|
@@ -280,3 +280,20 @@ int snd_seq_fifo_resize(struct snd_seq_fifo *f, int poolsize)
|
|
|
|
|
|
return 0;
|
|
|
}
|
|
|
+
|
|
|
+/* get the number of unused cells safely */
|
|
|
+int snd_seq_fifo_unused_cells(struct snd_seq_fifo *f)
|
|
|
+{
|
|
|
+ unsigned long flags;
|
|
|
+ int cells;
|
|
|
+
|
|
|
+ if (!f)
|
|
|
+ return 0;
|
|
|
+
|
|
|
+ snd_use_lock_use(&f->use_lock);
|
|
|
+ spin_lock_irqsave(&f->lock, flags);
|
|
|
+ cells = snd_seq_unused_cells(f->pool);
|
|
|
+ spin_unlock_irqrestore(&f->lock, flags);
|
|
|
+ snd_use_lock_free(&f->use_lock);
|
|
|
+ return cells;
|
|
|
+}
|