|
@@ -1236,6 +1236,28 @@ int snd_rawmidi_transmit(struct snd_rawmidi_substream *substream,
|
|
|
}
|
|
|
EXPORT_SYMBOL(snd_rawmidi_transmit);
|
|
|
|
|
|
+/**
|
|
|
+ * snd_rawmidi_proceed - Discard the all pending bytes and proceed
|
|
|
+ * @substream: rawmidi substream
|
|
|
+ *
|
|
|
+ * Return: the number of discarded bytes
|
|
|
+ */
|
|
|
+int snd_rawmidi_proceed(struct snd_rawmidi_substream *substream)
|
|
|
+{
|
|
|
+ struct snd_rawmidi_runtime *runtime = substream->runtime;
|
|
|
+ unsigned long flags;
|
|
|
+ int count = 0;
|
|
|
+
|
|
|
+ spin_lock_irqsave(&runtime->lock, flags);
|
|
|
+ if (runtime->avail < runtime->buffer_size) {
|
|
|
+ count = runtime->buffer_size - runtime->avail;
|
|
|
+ __snd_rawmidi_transmit_ack(substream, count);
|
|
|
+ }
|
|
|
+ spin_unlock_irqrestore(&runtime->lock, flags);
|
|
|
+ return count;
|
|
|
+}
|
|
|
+EXPORT_SYMBOL(snd_rawmidi_proceed);
|
|
|
+
|
|
|
static long snd_rawmidi_kernel_write1(struct snd_rawmidi_substream *substream,
|
|
|
const unsigned char __user *userbuf,
|
|
|
const unsigned char *kernelbuf,
|