git://git.onelab.eu
/
linux-2.6.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git]
/
sound
/
core
/
seq
/
seq_midi.c
diff --git
a/sound/core/seq/seq_midi.c
b/sound/core/seq/seq_midi.c
index
ce0df86
..
1daa5b0
100644
(file)
--- a/
sound/core/seq/seq_midi.c
+++ b/
sound/core/seq/seq_midi.c
@@
-32,7
+32,7
@@
Possible options for midisynth module:
#include <linux/errno.h>
#include <linux/string.h>
#include <linux/moduleparam.h>
#include <linux/errno.h>
#include <linux/string.h>
#include <linux/moduleparam.h>
-#include <
asm/semaphore
.h>
+#include <
linux/mutex
.h>
#include <sound/core.h>
#include <sound/rawmidi.h>
#include <sound/seq_kernel.h>
#include <sound/core.h>
#include <sound/rawmidi.h>
#include <sound/seq_kernel.h>
@@
-70,7
+70,7
@@
struct seq_midisynth_client {
};
static struct seq_midisynth_client *synths[SNDRV_CARDS];
};
static struct seq_midisynth_client *synths[SNDRV_CARDS];
-static DE
CLAR
E_MUTEX(register_mutex);
+static DE
FIN
E_MUTEX(register_mutex);
/* handle rawmidi input event (MIDI v1.0 stream) */
static void snd_midi_input_event(struct snd_rawmidi_substream *substream)
/* handle rawmidi input event (MIDI v1.0 stream) */
static void snd_midi_input_event(struct snd_rawmidi_substream *substream)
@@
-278,6
+278,7
@@
snd_seq_midisynth_register_port(struct snd_seq_device *dev)
struct seq_midisynth *msynth, *ms;
struct snd_seq_port_info *port;
struct snd_rawmidi_info *info;
struct seq_midisynth *msynth, *ms;
struct snd_seq_port_info *port;
struct snd_rawmidi_info *info;
+ struct snd_rawmidi *rmidi = dev->private_data;
int newclient = 0;
unsigned int p, ports;
struct snd_seq_port_callback pcallbacks;
int newclient = 0;
unsigned int p, ports;
struct snd_seq_port_callback pcallbacks;
@@
-308,23
+309,23
@@
snd_seq_midisynth_register_port(struct snd_seq_device *dev)
if (ports > (256 / SNDRV_RAWMIDI_DEVICES))
ports = 256 / SNDRV_RAWMIDI_DEVICES;
if (ports > (256 / SNDRV_RAWMIDI_DEVICES))
ports = 256 / SNDRV_RAWMIDI_DEVICES;
-
down
(®ister_mutex);
+
mutex_lock
(®ister_mutex);
client = synths[card->number];
if (client == NULL) {
newclient = 1;
client = kzalloc(sizeof(*client), GFP_KERNEL);
if (client == NULL) {
client = synths[card->number];
if (client == NULL) {
newclient = 1;
client = kzalloc(sizeof(*client), GFP_KERNEL);
if (client == NULL) {
-
up
(®ister_mutex);
+
mutex_unlock
(®ister_mutex);
kfree(info);
return -ENOMEM;
}
client->seq_client =
snd_seq_create_kernel_client(
kfree(info);
return -ENOMEM;
}
client->seq_client =
snd_seq_create_kernel_client(
- card, 0, "%s",
info->
name[0] ?
- (const char *)
info->
name : "External MIDI");
+ card, 0, "%s",
card->short
name[0] ?
+ (const char *)
card->short
name : "External MIDI");
if (client->seq_client < 0) {
kfree(client);
if (client->seq_client < 0) {
kfree(client);
-
up
(®ister_mutex);
+
mutex_unlock
(®ister_mutex);
kfree(info);
return -ENOMEM;
}
kfree(info);
return -ENOMEM;
}
@@
-376,7
+377,9
@@
snd_seq_midisynth_register_port(struct snd_seq_device *dev)
if ((port->capability & (SNDRV_SEQ_PORT_CAP_WRITE|SNDRV_SEQ_PORT_CAP_READ)) == (SNDRV_SEQ_PORT_CAP_WRITE|SNDRV_SEQ_PORT_CAP_READ) &&
info->flags & SNDRV_RAWMIDI_INFO_DUPLEX)
port->capability |= SNDRV_SEQ_PORT_CAP_DUPLEX;
if ((port->capability & (SNDRV_SEQ_PORT_CAP_WRITE|SNDRV_SEQ_PORT_CAP_READ)) == (SNDRV_SEQ_PORT_CAP_WRITE|SNDRV_SEQ_PORT_CAP_READ) &&
info->flags & SNDRV_RAWMIDI_INFO_DUPLEX)
port->capability |= SNDRV_SEQ_PORT_CAP_DUPLEX;
- port->type = SNDRV_SEQ_PORT_TYPE_MIDI_GENERIC;
+ port->type = SNDRV_SEQ_PORT_TYPE_MIDI_GENERIC
+ | SNDRV_SEQ_PORT_TYPE_HARDWARE
+ | SNDRV_SEQ_PORT_TYPE_PORT;
port->midi_channels = 16;
memset(&pcallbacks, 0, sizeof(pcallbacks));
pcallbacks.owner = THIS_MODULE;
port->midi_channels = 16;
memset(&pcallbacks, 0, sizeof(pcallbacks));
pcallbacks.owner = THIS_MODULE;
@@
-387,6
+390,8
@@
snd_seq_midisynth_register_port(struct snd_seq_device *dev)
pcallbacks.unuse = midisynth_unuse;
pcallbacks.event_input = event_process_midi;
port->kernel = &pcallbacks;
pcallbacks.unuse = midisynth_unuse;
pcallbacks.event_input = event_process_midi;
port->kernel = &pcallbacks;
+ if (rmidi->ops && rmidi->ops->get_port_info)
+ rmidi->ops->get_port_info(rmidi, p, port);
if (snd_seq_kernel_client_ctl(client->seq_client, SNDRV_SEQ_IOCTL_CREATE_PORT, port)<0)
goto __nomem;
ms->seq_client = client->seq_client;
if (snd_seq_kernel_client_ctl(client->seq_client, SNDRV_SEQ_IOCTL_CREATE_PORT, port)<0)
goto __nomem;
ms->seq_client = client->seq_client;
@@
-397,7
+402,7
@@
snd_seq_midisynth_register_port(struct snd_seq_device *dev)
client->num_ports++;
if (newclient)
synths[card->number] = client;
client->num_ports++;
if (newclient)
synths[card->number] = client;
-
up
(®ister_mutex);
+
mutex_unlock
(®ister_mutex);
kfree(info);
kfree(port);
return 0; /* success */
kfree(info);
kfree(port);
return 0; /* success */
@@
-414,7
+419,7
@@
snd_seq_midisynth_register_port(struct snd_seq_device *dev)
}
kfree(info);
kfree(port);
}
kfree(info);
kfree(port);
-
up
(®ister_mutex);
+
mutex_unlock
(®ister_mutex);
return -ENOMEM;
}
return -ENOMEM;
}
@@
-427,10
+432,10
@@
snd_seq_midisynth_unregister_port(struct snd_seq_device *dev)
struct snd_card *card = dev->card;
int device = dev->device, p, ports;
struct snd_card *card = dev->card;
int device = dev->device, p, ports;
-
down
(®ister_mutex);
+
mutex_lock
(®ister_mutex);
client = synths[card->number];
if (client == NULL || client->ports[device] == NULL) {
client = synths[card->number];
if (client == NULL || client->ports[device] == NULL) {
-
up
(®ister_mutex);
+
mutex_unlock
(®ister_mutex);
return -ENODEV;
}
ports = client->ports_per_device[device];
return -ENODEV;
}
ports = client->ports_per_device[device];
@@
-446,7
+451,7
@@
snd_seq_midisynth_unregister_port(struct snd_seq_device *dev)
synths[card->number] = NULL;
kfree(client);
}
synths[card->number] = NULL;
kfree(client);
}
-
up
(®ister_mutex);
+
mutex_unlock
(®ister_mutex);
return 0;
}
return 0;
}