void snd_hdac_ext_stream_decouple(struct hdac_bus *bus,
struct hdac_ext_stream *hext_stream, bool decouple)
{
- spin_lock_irq(&bus->reg_lock);
+ guard(spinlock_irq)(&bus->reg_lock);
snd_hdac_ext_stream_decouple_locked(bus, hext_stream, decouple);
- spin_unlock_irq(&bus->reg_lock);
}
EXPORT_SYMBOL_GPL(snd_hdac_ext_stream_decouple);
return NULL;
}
- spin_lock_irq(&bus->reg_lock);
+ guard(spinlock_irq)(&bus->reg_lock);
list_for_each_entry(hstream, &bus->stream_list, list) {
struct hdac_ext_stream *hext_stream = container_of(hstream,
struct hdac_ext_stream,
res->link_locked = 1;
res->link_substream = substream;
}
- spin_unlock_irq(&bus->reg_lock);
return res;
}
return NULL;
}
- spin_lock_irq(&bus->reg_lock);
+ guard(spinlock_irq)(&bus->reg_lock);
list_for_each_entry(hstream, &bus->stream_list, list) {
struct hdac_ext_stream *hext_stream = container_of(hstream,
struct hdac_ext_stream,
res->hstream.running = 0;
res->hstream.substream = substream;
}
- spin_unlock_irq(&bus->reg_lock);
return res;
}
break;
case HDAC_EXT_STREAM_TYPE_HOST:
- spin_lock_irq(&bus->reg_lock);
- /* couple link only if not in use */
- if (!hext_stream->link_locked)
- snd_hdac_ext_stream_decouple_locked(bus, hext_stream, false);
- snd_hdac_stream_release_locked(&hext_stream->hstream);
- spin_unlock_irq(&bus->reg_lock);
+ scoped_guard(spinlock_irq, &bus->reg_lock) {
+ /* couple link only if not in use */
+ if (!hext_stream->link_locked)
+ snd_hdac_ext_stream_decouple_locked(bus, hext_stream, false);
+ snd_hdac_stream_release_locked(&hext_stream->hstream);
+ }
break;
case HDAC_EXT_STREAM_TYPE_LINK:
- spin_lock_irq(&bus->reg_lock);
- /* couple host only if not in use */
- if (!hext_stream->hstream.opened)
- snd_hdac_ext_stream_decouple_locked(bus, hext_stream, false);
- hext_stream->link_locked = 0;
- hext_stream->link_substream = NULL;
- spin_unlock_irq(&bus->reg_lock);
+ scoped_guard(spinlock_irq, &bus->reg_lock) {
+ /* couple host only if not in use */
+ if (!hext_stream->hstream.opened)
+ snd_hdac_ext_stream_decouple_locked(bus, hext_stream, false);
+ hext_stream->link_locked = 0;
+ hext_stream->link_substream = NULL;
+ }
break;
default:
struct hdac_ext_stream *res = NULL;
struct hdac_stream *hstream;
- spin_lock_irq(&bus->reg_lock);
+ guard(spinlock_irq)(&bus->reg_lock);
list_for_each_entry(hstream, &bus->stream_list, list) {
struct hdac_ext_stream *hext_stream = stream_to_hdac_ext_stream(hstream);
res->hstream.running = 0;
res->hstream.cstream = cstream;
}
- spin_unlock_irq(&bus->reg_lock);
return res;
}