#include <linux/errno.h>
#include <linux/string.h>
#include <linux/moduleparam.h>
-#include <linux/mutex.h>
+#include <asm/semaphore.h>
#include <sound/core.h>
#include <sound/rawmidi.h>
#include <sound/seq_kernel.h>
};
static struct seq_midisynth_client *synths[SNDRV_CARDS];
-static DEFINE_MUTEX(register_mutex);
+static DECLARE_MUTEX(register_mutex);
/* handle rawmidi input event (MIDI v1.0 stream) */
static void snd_midi_input_event(struct snd_rawmidi_substream *substream)
if (ports > (256 / SNDRV_RAWMIDI_DEVICES))
ports = 256 / SNDRV_RAWMIDI_DEVICES;
- mutex_lock(®ister_mutex);
+ down(®ister_mutex);
client = synths[card->number];
if (client == NULL) {
newclient = 1;
client = kzalloc(sizeof(*client), GFP_KERNEL);
if (client == NULL) {
- mutex_unlock(®ister_mutex);
+ up(®ister_mutex);
kfree(info);
return -ENOMEM;
}
(const char *)info->name : "External MIDI");
if (client->seq_client < 0) {
kfree(client);
- mutex_unlock(®ister_mutex);
+ up(®ister_mutex);
kfree(info);
return -ENOMEM;
}
client->num_ports++;
if (newclient)
synths[card->number] = client;
- mutex_unlock(®ister_mutex);
+ up(®ister_mutex);
kfree(info);
kfree(port);
return 0; /* success */
}
kfree(info);
kfree(port);
- mutex_unlock(®ister_mutex);
+ up(®ister_mutex);
return -ENOMEM;
}
struct snd_card *card = dev->card;
int device = dev->device, p, ports;
- mutex_lock(®ister_mutex);
+ down(®ister_mutex);
client = synths[card->number];
if (client == NULL || client->ports[device] == NULL) {
- mutex_unlock(®ister_mutex);
+ up(®ister_mutex);
return -ENODEV;
}
ports = client->ports_per_device[device];
synths[card->number] = NULL;
kfree(client);
}
- mutex_unlock(®ister_mutex);
+ up(®ister_mutex);
return 0;
}