static int
odev_open(struct inode *inode, struct file *file)
{
- int level, rc;
+ int level;
if (iminor(inode) == SNDRV_MINOR_OSS_MUSIC)
level = SNDRV_SEQ_OSS_MODE_MUSIC;
else
level = SNDRV_SEQ_OSS_MODE_SYNTH;
- mutex_lock(®ister_mutex);
- rc = snd_seq_oss_open(file, level);
- mutex_unlock(®ister_mutex);
-
- return rc;
+ guard(mutex)(®ister_mutex);
+ return snd_seq_oss_open(file, level);
}
static int
if (!dp)
return 0;
- mutex_lock(®ister_mutex);
+ guard(mutex)(®ister_mutex);
snd_seq_oss_release(dp);
- mutex_unlock(®ister_mutex);
-
return 0;
}
{
int rc;
- mutex_lock(®ister_mutex);
+ guard(mutex)(®ister_mutex);
rc = snd_register_oss_device(SNDRV_OSS_DEVICE_TYPE_SEQUENCER,
NULL, 0,
&seq_oss_f_ops, NULL);
if (rc < 0) {
pr_err("ALSA: seq_oss: can't register device seq\n");
- mutex_unlock(®ister_mutex);
return rc;
}
rc = snd_register_oss_device(SNDRV_OSS_DEVICE_TYPE_MUSIC,
if (rc < 0) {
pr_err("ALSA: seq_oss: can't register device music\n");
snd_unregister_oss_device(SNDRV_OSS_DEVICE_TYPE_SEQUENCER, NULL, 0);
- mutex_unlock(®ister_mutex);
return rc;
}
- mutex_unlock(®ister_mutex);
return 0;
}
static void
unregister_device(void)
{
- mutex_lock(®ister_mutex);
+ guard(mutex)(®ister_mutex);
if (snd_unregister_oss_device(SNDRV_OSS_DEVICE_TYPE_MUSIC, NULL, 0) < 0)
pr_err("ALSA: seq_oss: error unregister device music\n");
if (snd_unregister_oss_device(SNDRV_OSS_DEVICE_TYPE_SEQUENCER, NULL, 0) < 0)
pr_err("ALSA: seq_oss: error unregister device seq\n");
- mutex_unlock(®ister_mutex);
}
/*
static void
info_read(struct snd_info_entry *entry, struct snd_info_buffer *buf)
{
- mutex_lock(®ister_mutex);
+ guard(mutex)(®ister_mutex);
snd_iprintf(buf, "OSS sequencer emulation version %s\n", SNDRV_SEQ_OSS_VERSION_STR);
snd_seq_oss_system_info_read(buf);
snd_seq_oss_synth_info_read(buf);
snd_seq_oss_midi_info_read(buf);
- mutex_unlock(®ister_mutex);
}