summaryrefslogtreecommitdiff
path: root/sound/synth/emux/emux_seq.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/synth/emux/emux_seq.c')
-rw-r--r--sound/synth/emux/emux_seq.c51
1 files changed, 15 insertions, 36 deletions
diff --git a/sound/synth/emux/emux_seq.c b/sound/synth/emux/emux_seq.c
index 396c406d0f77..9d63ac006aa5 100644
--- a/sound/synth/emux/emux_seq.c
+++ b/sound/synth/emux/emux_seq.c
@@ -1,22 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Midi Sequencer interface routines.
*
* Copyright (C) 1999 Steve Ratcliffe
* Copyright (c) 1999-2000 Takashi Iwai <tiwai@suse.de>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "emux_voice.h"
@@ -32,7 +19,7 @@ static int snd_emux_unuse(void *private_data, struct snd_seq_port_subscribe *inf
/*
* MIDI emulation operators
*/
-static struct snd_midi_op emux_ops = {
+static const struct snd_midi_op emux_ops = {
.note_on = snd_emux_note_on,
.note_off = snd_emux_note_off,
.key_press = snd_emux_key_press,
@@ -74,16 +61,17 @@ snd_emux_init_seq(struct snd_emux *emu, struct snd_card *card, int index)
emu->client = snd_seq_create_kernel_client(card, index,
"%s WaveTable", emu->name);
if (emu->client < 0) {
- snd_printk(KERN_ERR "can't create client\n");
+ dev_err(card->dev, "can't create client\n");
return -ENODEV;
}
- if (emu->num_ports < 0) {
- snd_printk(KERN_WARNING "seqports must be greater than zero\n");
+ if (emu->num_ports <= 0) {
+ dev_warn(card->dev, "seqports must be greater than zero\n");
emu->num_ports = 1;
- } else if (emu->num_ports >= SNDRV_EMUX_MAX_PORTS) {
- snd_printk(KERN_WARNING "too many ports."
- "limited max. ports %d\n", SNDRV_EMUX_MAX_PORTS);
+ } else if (emu->num_ports > SNDRV_EMUX_MAX_PORTS) {
+ dev_warn(card->dev,
+ "too many ports. limited max. ports %d\n",
+ SNDRV_EMUX_MAX_PORTS);
emu->num_ports = SNDRV_EMUX_MAX_PORTS;
}
@@ -100,7 +88,7 @@ snd_emux_init_seq(struct snd_emux *emu, struct snd_card *card, int index)
p = snd_emux_create_port(emu, tmpname, MIDI_CHANNELS,
0, &pinfo);
if (!p) {
- snd_printk(KERN_ERR "can't create port\n");
+ dev_err(card->dev, "can't create port\n");
return -ENOMEM;
}
@@ -284,12 +272,8 @@ __snd_emux_inc_count(struct snd_emux *emu)
int snd_emux_inc_count(struct snd_emux *emu)
{
- int ret;
-
- mutex_lock(&emu->register_mutex);
- ret = __snd_emux_inc_count(emu);
- mutex_unlock(&emu->register_mutex);
- return ret;
+ guard(mutex)(&emu->register_mutex);
+ return __snd_emux_inc_count(emu);
}
/*
@@ -307,9 +291,8 @@ __snd_emux_dec_count(struct snd_emux *emu)
void snd_emux_dec_count(struct snd_emux *emu)
{
- mutex_lock(&emu->register_mutex);
+ guard(mutex)(&emu->register_mutex);
__snd_emux_dec_count(emu);
- mutex_unlock(&emu->register_mutex);
}
/*
@@ -328,10 +311,9 @@ snd_emux_use(void *private_data, struct snd_seq_port_subscribe *info)
if (snd_BUG_ON(!emu))
return -EINVAL;
- mutex_lock(&emu->register_mutex);
+ guard(mutex)(&emu->register_mutex);
snd_emux_init_port(p);
__snd_emux_inc_count(emu);
- mutex_unlock(&emu->register_mutex);
return 0;
}
@@ -351,10 +333,9 @@ snd_emux_unuse(void *private_data, struct snd_seq_port_subscribe *info)
if (snd_BUG_ON(!emu))
return -EINVAL;
- mutex_lock(&emu->register_mutex);
+ guard(mutex)(&emu->register_mutex);
snd_emux_sounds_off_all(p);
__snd_emux_dec_count(emu);
- mutex_unlock(&emu->register_mutex);
return 0;
}
@@ -389,12 +370,10 @@ int snd_emux_init_virmidi(struct snd_emux *emu, struct snd_card *card)
goto __error;
}
emu->vmidi[i] = rmidi;
- /* snd_printk(KERN_DEBUG "virmidi %d ok\n", i); */
}
return 0;
__error:
- /* snd_printk(KERN_DEBUG "error init..\n"); */
snd_emux_delete_virmidi(emu);
return -ENOMEM;
}