linux 2.6.16.38 w/ vs2.0.3-rc1
[linux-2.6.git] / sound / core / seq / seq_ports.c
index 8c64b58..2b384fd 100644 (file)
@@ -159,7 +159,7 @@ struct snd_seq_client_port *snd_seq_create_port(struct snd_seq_client *client,
        port_subs_info_init(&new_port->c_dest);
 
        num = port >= 0 ? port : 0;
-       mutex_lock(&client->ports_mutex);
+       down(&client->ports_mutex);
        write_lock_irqsave(&client->ports_lock, flags);
        list_for_each(l, &client->ports_list_head) {
                struct snd_seq_client_port *p = list_entry(l, struct snd_seq_client_port, list);
@@ -173,7 +173,7 @@ struct snd_seq_client_port *snd_seq_create_port(struct snd_seq_client *client,
        client->num_ports++;
        new_port->addr.port = num;      /* store the port number in the port */
        write_unlock_irqrestore(&client->ports_lock, flags);
-       mutex_unlock(&client->ports_mutex);
+       up(&client->ports_mutex);
        sprintf(new_port->name, "port-%d", num);
 
        return new_port;
@@ -221,6 +221,7 @@ static void clear_subscriber_list(struct snd_seq_client *client,
 {
        struct list_head *p, *n;
 
+       down_write(&grp->list_mutex);
        list_for_each_safe(p, n, &grp->list_head) {
                struct snd_seq_subscribers *subs;
                struct snd_seq_client *c;
@@ -258,6 +259,7 @@ static void clear_subscriber_list(struct snd_seq_client *client,
                        snd_seq_client_unlock(c);
                }
        }
+       up_write(&grp->list_mutex);
 }
 
 /* delete port data */
@@ -290,7 +292,7 @@ int snd_seq_delete_port(struct snd_seq_client *client, int port)
        struct list_head *l;
        struct snd_seq_client_port *found = NULL;
 
-       mutex_lock(&client->ports_mutex);
+       down(&client->ports_mutex);
        write_lock_irqsave(&client->ports_lock, flags);
        list_for_each(l, &client->ports_list_head) {
                struct snd_seq_client_port *p = list_entry(l, struct snd_seq_client_port, list);
@@ -303,7 +305,7 @@ int snd_seq_delete_port(struct snd_seq_client *client, int port)
                }
        }
        write_unlock_irqrestore(&client->ports_lock, flags);
-       mutex_unlock(&client->ports_mutex);
+       up(&client->ports_mutex);
        if (found)
                return port_delete(client, found);
        else
@@ -319,11 +321,13 @@ int snd_seq_delete_all_ports(struct snd_seq_client *client)
        /* move the port list to deleted_list, and
         * clear the port list in the client data.
         */
-       mutex_lock(&client->ports_mutex);
+       down(&client->ports_mutex);
        write_lock_irqsave(&client->ports_lock, flags);
        if (! list_empty(&client->ports_list_head)) {
-               list_add(&deleted_list, &client->ports_list_head);
-               list_del_init(&client->ports_list_head);
+               __list_add(&deleted_list,
+                          client->ports_list_head.prev,
+                          client->ports_list_head.next);
+               INIT_LIST_HEAD(&client->ports_list_head);
        } else {
                INIT_LIST_HEAD(&deleted_list);
        }
@@ -337,7 +341,7 @@ int snd_seq_delete_all_ports(struct snd_seq_client *client)
                snd_seq_system_client_ev_port_exit(port->addr.client, port->addr.port);
                port_delete(client, port);
        }
-       mutex_unlock(&client->ports_mutex);
+       up(&client->ports_mutex);
        return 0;
 }
 
@@ -514,7 +518,7 @@ int snd_seq_port_connect(struct snd_seq_client *connector,
        atomic_set(&subs->ref_count, 2);
 
        down_write(&src->list_mutex);
-       down_write_nested(&dest->list_mutex, SINGLE_DEPTH_NESTING);
+       down_write(&dest->list_mutex);
 
        exclusive = info->flags & SNDRV_SEQ_PORT_SUBS_EXCLUSIVE ? 1 : 0;
        err = -EBUSY;
@@ -587,7 +591,7 @@ int snd_seq_port_disconnect(struct snd_seq_client *connector,
        unsigned long flags;
 
        down_write(&src->list_mutex);
-       down_write_nested(&dest->list_mutex, SINGLE_DEPTH_NESTING);
+       down_write(&dest->list_mutex);
 
        /* look for the connection */
        list_for_each(p, &src->list_head) {
@@ -673,7 +677,6 @@ int snd_seq_event_port_attach(int client,
        return ret;
 }
 
-EXPORT_SYMBOL(snd_seq_event_port_attach);
 
 /*
  * Detach the driver from a port.
@@ -693,5 +696,3 @@ int snd_seq_event_port_detach(int client, int port)
 
        return err;
 }
-
-EXPORT_SYMBOL(snd_seq_event_port_detach);