Skip to content

Commit 6ccf998

Browse files
recallmenottiwai
authored andcommitted
Revert "ALSA: firewire-lib: obsolete workqueue for period update"
prepare resolution of AB/BA deadlock competition for substream lock: restore workqueue previously used for process context: revert commit b5b5199 ("ALSA: firewire-lib: obsolete workqueue for period update") Cc: [email protected] Link: https://lore.kernel.org/r/kwryofzdmjvzkuw6j3clftsxmoolynljztxqwg76hzeo4simnl@jn3eo7pe642q/ Signed-off-by: Edmund Raile <[email protected]> Reviewed-by: Takashi Sakamoto <[email protected]> Signed-off-by: Takashi Iwai <[email protected]> Link: https://patch.msgid.link/[email protected]
1 parent 3c0b6f9 commit 6ccf998

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

sound/firewire/amdtp-stream.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@
7777
// overrun. Actual device can skip more, then this module stops the packet streaming.
7878
#define IR_JUMBO_PAYLOAD_MAX_SKIP_CYCLES 5
7979

80+
static void pcm_period_work(struct work_struct *work);
81+
8082
/**
8183
* amdtp_stream_init - initialize an AMDTP stream structure
8284
* @s: the AMDTP stream to initialize
@@ -105,6 +107,7 @@ int amdtp_stream_init(struct amdtp_stream *s, struct fw_unit *unit,
105107
s->flags = flags;
106108
s->context = ERR_PTR(-1);
107109
mutex_init(&s->mutex);
110+
INIT_WORK(&s->period_work, pcm_period_work);
108111
s->packet_index = 0;
109112

110113
init_waitqueue_head(&s->ready_wait);
@@ -347,6 +350,7 @@ EXPORT_SYMBOL(amdtp_stream_get_max_payload);
347350
*/
348351
void amdtp_stream_pcm_prepare(struct amdtp_stream *s)
349352
{
353+
cancel_work_sync(&s->period_work);
350354
s->pcm_buffer_pointer = 0;
351355
s->pcm_period_pointer = 0;
352356
}
@@ -624,6 +628,16 @@ static void update_pcm_pointers(struct amdtp_stream *s,
624628
}
625629
}
626630

631+
static void pcm_period_work(struct work_struct *work)
632+
{
633+
struct amdtp_stream *s = container_of(work, struct amdtp_stream,
634+
period_work);
635+
struct snd_pcm_substream *pcm = READ_ONCE(s->pcm);
636+
637+
if (pcm)
638+
snd_pcm_period_elapsed(pcm);
639+
}
640+
627641
static int queue_packet(struct amdtp_stream *s, struct fw_iso_packet *params,
628642
bool sched_irq)
629643
{
@@ -1910,6 +1924,7 @@ static void amdtp_stream_stop(struct amdtp_stream *s)
19101924
return;
19111925
}
19121926

1927+
cancel_work_sync(&s->period_work);
19131928
fw_iso_context_stop(s->context);
19141929
fw_iso_context_destroy(s->context);
19151930
s->context = ERR_PTR(-1);

sound/firewire/amdtp-stream.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,7 @@ struct amdtp_stream {
191191

192192
/* For a PCM substream processing. */
193193
struct snd_pcm_substream *pcm;
194+
struct work_struct period_work;
194195
snd_pcm_uframes_t pcm_buffer_pointer;
195196
unsigned int pcm_period_pointer;
196197
unsigned int pcm_frame_multiplier;

0 commit comments

Comments
 (0)