]> git.karo-electronics.de Git - mv-sheeva.git/blobdiff - sound/drivers/opl3/opl3_seq.c
Merge master.kernel.org:/pub/scm/linux/kernel/git/gregkh/i2c-2.6
[mv-sheeva.git] / sound / drivers / opl3 / opl3_seq.c
index 582ff63e784bee00e3f182ede650dcb95c193b0b..96762c9d485578799c8a8fb6dbce6bad48f17953 100644 (file)
@@ -52,13 +52,13 @@ int snd_opl3_synth_setup(struct snd_opl3 * opl3)
 {
        int idx;
 
-       down(&opl3->access_mutex);
+       mutex_lock(&opl3->access_mutex);
        if (opl3->used) {
-               up(&opl3->access_mutex);
+               mutex_unlock(&opl3->access_mutex);
                return -EBUSY;
        }
        opl3->used++;
-       up(&opl3->access_mutex);
+       mutex_unlock(&opl3->access_mutex);
 
        snd_opl3_reset(opl3);
 
@@ -91,9 +91,9 @@ void snd_opl3_synth_cleanup(struct snd_opl3 * opl3)
        spin_unlock_irqrestore(&opl3->sys_timer_lock, flags);
 
        snd_opl3_reset(opl3);
-       down(&opl3->access_mutex);
+       mutex_lock(&opl3->access_mutex);
        opl3->used--;
-       up(&opl3->access_mutex);
+       mutex_unlock(&opl3->access_mutex);
 }
 
 static int snd_opl3_synth_use(void *private_data, struct snd_seq_port_subscribe * info)
@@ -203,12 +203,16 @@ static int snd_opl3_synth_create_port(struct snd_opl3 * opl3)
                                                      SNDRV_SEQ_PORT_CAP_SUBS_WRITE,
                                                      SNDRV_SEQ_PORT_TYPE_MIDI_GENERIC |
                                                      SNDRV_SEQ_PORT_TYPE_MIDI_GM |
-                                                     SNDRV_SEQ_PORT_TYPE_SYNTH,
+                                                     SNDRV_SEQ_PORT_TYPE_DIRECT_SAMPLE |
+                                                     SNDRV_SEQ_PORT_TYPE_HARDWARE |
+                                                     SNDRV_SEQ_PORT_TYPE_SYNTHESIZER,
                                                      16, voices,
                                                      name);
        if (opl3->chset->port < 0) {
+               int port;
+               port = opl3->chset->port;
                snd_midi_channel_free_set(opl3->chset);
-               return opl3->chset->port;
+               return port;
        }
        return 0;
 }
@@ -218,8 +222,8 @@ static int snd_opl3_synth_create_port(struct snd_opl3 * opl3)
 static int snd_opl3_seq_new_device(struct snd_seq_device *dev)
 {
        struct snd_opl3 *opl3;
-       int client;
-       struct snd_seq_client_info cinfo;
+       int client, err;
+       char name[32];
        int opl_ver;
 
        opl3 = *(struct snd_opl3 **)SNDRV_SEQ_DEVICE_ARGPTR(dev);
@@ -231,20 +235,19 @@ static int snd_opl3_seq_new_device(struct snd_seq_device *dev)
        opl3->seq_client = -1;
 
        /* allocate new client */
+       opl_ver = (opl3->hardware & OPL3_HW_MASK) >> 8;
+       sprintf(name, "OPL%i FM synth", opl_ver);
        client = opl3->seq_client =
-               snd_seq_create_kernel_client(opl3->card, opl3->seq_dev_num);
+               snd_seq_create_kernel_client(opl3->card, opl3->seq_dev_num,
+                                            name);
        if (client < 0)
                return client;
 
-       /* change name of client */
-       memset(&cinfo, 0, sizeof(cinfo));
-       cinfo.client = client;
-       cinfo.type = KERNEL_CLIENT;
-       opl_ver = (opl3->hardware & OPL3_HW_MASK) >> 8;
-       sprintf(cinfo.name, "OPL%i FM synth", opl_ver);
-       snd_seq_kernel_client_ctl(client, SNDRV_SEQ_IOCTL_SET_CLIENT_INFO, &cinfo);
-
-       snd_opl3_synth_create_port(opl3);
+       if ((err = snd_opl3_synth_create_port(opl3)) < 0) {
+               snd_seq_delete_kernel_client(client);
+               opl3->seq_client = -1;
+               return err;
+       }
 
        /* initialize instrument list */
        opl3->ilist = snd_seq_instr_list_new();
@@ -264,7 +267,7 @@ static int snd_opl3_seq_new_device(struct snd_seq_device *dev)
        opl3->sys_timer_status = 0;
 
 #ifdef CONFIG_SND_SEQUENCER_OSS
-       snd_opl3_init_seq_oss(opl3, cinfo.name);
+       snd_opl3_init_seq_oss(opl3, name);
 #endif
        return 0;
 }