Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions sound/soc/sof/intel/hda-stream.c
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,8 @@ hda_dsp_stream_get(struct snd_sof_dev *sdev, int direction)
struct hdac_ext_stream *stream = NULL;
struct hdac_stream *s;

spin_lock_irq(&bus->reg_lock);

/* get an unused stream */
list_for_each_entry(s, &bus->stream_list, list) {
if (s->direction == direction && !s->opened) {
Expand All @@ -179,6 +181,8 @@ hda_dsp_stream_get(struct snd_sof_dev *sdev, int direction)
}
}

spin_unlock_irq(&bus->reg_lock);

/* stream found ? */
if (!stream)
dev_err(sdev->dev, "error: no free %s streams\n",
Expand All @@ -194,15 +198,20 @@ int hda_dsp_stream_put(struct snd_sof_dev *sdev, int direction, int tag)
struct hdac_bus *bus = sof_to_bus(sdev);
struct hdac_stream *s;

spin_lock_irq(&bus->reg_lock);

/* find used stream */
list_for_each_entry(s, &bus->stream_list, list) {
if (s->direction == direction &&
s->opened && s->stream_tag == tag) {
s->opened = false;
spin_unlock_irq(&bus->reg_lock);
return 0;
}
}

spin_unlock_irq(&bus->reg_lock);

dev_dbg(sdev->dev, "tag %d not opened!\n", tag);
return -ENODEV;
}
Expand Down