mirror of https://github.com/torvalds/linux.git
ALSA: firewire: isight: Use guard() for mutex locks
Replace the manual mutex lock/unlock pairs with guard() for code simplification. Only code refactoring, and no behavior change. Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de> Link: https://patch.msgid.link/20250828132802.9032-10-tiwai@suse.de
This commit is contained in:
parent
a1c55ef6e9
commit
b8ed2b1432
|
|
@ -327,9 +327,8 @@ static int isight_hw_free(struct snd_pcm_substream *substream)
|
|||
|
||||
WRITE_ONCE(isight->pcm_active, false);
|
||||
|
||||
mutex_lock(&isight->mutex);
|
||||
guard(mutex)(&isight->mutex);
|
||||
isight_stop_streaming(isight);
|
||||
mutex_unlock(&isight->mutex);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -400,16 +399,12 @@ static int isight_start_streaming(struct isight *isight)
|
|||
static int isight_prepare(struct snd_pcm_substream *substream)
|
||||
{
|
||||
struct isight *isight = substream->private_data;
|
||||
int err;
|
||||
|
||||
isight->buffer_pointer = 0;
|
||||
isight->period_counter = 0;
|
||||
|
||||
mutex_lock(&isight->mutex);
|
||||
err = isight_start_streaming(isight);
|
||||
mutex_unlock(&isight->mutex);
|
||||
|
||||
return err;
|
||||
guard(mutex)(&isight->mutex);
|
||||
return isight_start_streaming(isight);
|
||||
}
|
||||
|
||||
static int isight_trigger(struct snd_pcm_substream *substream, int cmd)
|
||||
|
|
@ -677,9 +672,8 @@ static void isight_bus_reset(struct fw_unit *unit)
|
|||
if (fw_iso_resources_update(&isight->resources) < 0) {
|
||||
isight_pcm_abort(isight);
|
||||
|
||||
mutex_lock(&isight->mutex);
|
||||
guard(mutex)(&isight->mutex);
|
||||
isight_stop_streaming(isight);
|
||||
mutex_unlock(&isight->mutex);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -691,9 +685,9 @@ static void isight_remove(struct fw_unit *unit)
|
|||
|
||||
snd_card_disconnect(isight->card);
|
||||
|
||||
mutex_lock(&isight->mutex);
|
||||
isight_stop_streaming(isight);
|
||||
mutex_unlock(&isight->mutex);
|
||||
scoped_guard(mutex, &isight->mutex) {
|
||||
isight_stop_streaming(isight);
|
||||
}
|
||||
|
||||
// Block till all of ALSA character devices are released.
|
||||
snd_card_free(isight->card);
|
||||
|
|
|
|||
Loading…
Reference in New Issue