@@ -60,6 +60,7 @@
#define OUT_PACKET_HEADER_SIZE 0
static void pcm_period_tasklet(unsigned long data);
+static void stream_abort(struct amdtp_stream *s, bool locked);
/**
* amdtp_stream_init - initialize an AMDTP stream structure
@@ -701,7 +702,7 @@ static void out_stream_callback(struct fw_iso_context *context, u32 tstamp,
cycle = increment_cycle_count(cycle, 1);
if (s->handle_packet(s, 0, cycle, i) < 0) {
s->packet_index = -1;
- amdtp_stream_pcm_abort(s);
+ stream_abort(s, !in_interrupt());
return;
}
}
@@ -753,7 +754,7 @@ static void in_stream_callback(struct fw_iso_context *context, u32 tstamp,
/* Queueing error or detecting invalid payload. */
if (i < packets) {
s->packet_index = -1;
- amdtp_stream_pcm_abort(s);
+ stream_abort(s, !in_interrupt());
return;
}
@@ -1007,6 +1008,19 @@ void amdtp_stream_stop(struct amdtp_stream *s)
}
EXPORT_SYMBOL(amdtp_stream_stop);
+static void stream_abort(struct amdtp_stream *s, bool locked)
+{
+ struct snd_pcm_substream *pcm;
+
+ pcm = ACCESS_ONCE(s->pcm);
+ if (pcm) {
+ if (locked)
+ snd_pcm_stop(pcm, SNDRV_PCM_STATE_XRUN);
+ else
+ snd_pcm_stop_xrun(pcm);
+ }
+}
+
/**
* amdtp_stream_pcm_abort - abort the running PCM device
* @s: the AMDTP stream about to be stopped
@@ -1016,10 +1030,6 @@ EXPORT_SYMBOL(amdtp_stream_stop);
*/
void amdtp_stream_pcm_abort(struct amdtp_stream *s)
{
- struct snd_pcm_substream *pcm;
-
- pcm = ACCESS_ONCE(s->pcm);
- if (pcm)
- snd_pcm_stop_xrun(pcm);
+ stream_abort(s, false);
}
EXPORT_SYMBOL(amdtp_stream_pcm_abort);