| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * ALSA sequencer Ports |
|---|
| 3 | 4 | * Copyright (c) 1998 by Frank van de Pol <fvdpol@coil.demon.nl> |
|---|
| 4 | 5 | * Jaroslav Kysela <perex@perex.cz> |
|---|
| 5 | | - * |
|---|
| 6 | | - * |
|---|
| 7 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 8 | | - * it under the terms of the GNU General Public License as published by |
|---|
| 9 | | - * the Free Software Foundation; either version 2 of the License, or |
|---|
| 10 | | - * (at your option) any later version. |
|---|
| 11 | | - * |
|---|
| 12 | | - * This program is distributed in the hope that it will be useful, |
|---|
| 13 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 14 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 15 | | - * GNU General Public License for more details. |
|---|
| 16 | | - * |
|---|
| 17 | | - * You should have received a copy of the GNU General Public License |
|---|
| 18 | | - * along with this program; if not, write to the Free Software |
|---|
| 19 | | - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|---|
| 20 | | - * |
|---|
| 21 | 6 | */ |
|---|
| 22 | 7 | |
|---|
| 23 | 8 | #include <sound/core.h> |
|---|
| .. | .. |
|---|
| 128 | 113 | struct snd_seq_client_port *snd_seq_create_port(struct snd_seq_client *client, |
|---|
| 129 | 114 | int port) |
|---|
| 130 | 115 | { |
|---|
| 131 | | - unsigned long flags; |
|---|
| 132 | 116 | struct snd_seq_client_port *new_port, *p; |
|---|
| 133 | 117 | int num = -1; |
|---|
| 134 | 118 | |
|---|
| .. | .. |
|---|
| 157 | 141 | |
|---|
| 158 | 142 | num = port >= 0 ? port : 0; |
|---|
| 159 | 143 | mutex_lock(&client->ports_mutex); |
|---|
| 160 | | - write_lock_irqsave(&client->ports_lock, flags); |
|---|
| 144 | + write_lock_irq(&client->ports_lock); |
|---|
| 161 | 145 | list_for_each_entry(p, &client->ports_list_head, list) { |
|---|
| 162 | 146 | if (p->addr.port > num) |
|---|
| 163 | 147 | break; |
|---|
| .. | .. |
|---|
| 169 | 153 | client->num_ports++; |
|---|
| 170 | 154 | new_port->addr.port = num; /* store the port number in the port */ |
|---|
| 171 | 155 | sprintf(new_port->name, "port-%d", num); |
|---|
| 172 | | - write_unlock_irqrestore(&client->ports_lock, flags); |
|---|
| 156 | + write_unlock_irq(&client->ports_lock); |
|---|
| 173 | 157 | mutex_unlock(&client->ports_mutex); |
|---|
| 174 | 158 | |
|---|
| 175 | 159 | return new_port; |
|---|
| .. | .. |
|---|
| 283 | 267 | /* delete a port with the given port id */ |
|---|
| 284 | 268 | int snd_seq_delete_port(struct snd_seq_client *client, int port) |
|---|
| 285 | 269 | { |
|---|
| 286 | | - unsigned long flags; |
|---|
| 287 | 270 | struct snd_seq_client_port *found = NULL, *p; |
|---|
| 288 | 271 | |
|---|
| 289 | 272 | mutex_lock(&client->ports_mutex); |
|---|
| 290 | | - write_lock_irqsave(&client->ports_lock, flags); |
|---|
| 273 | + write_lock_irq(&client->ports_lock); |
|---|
| 291 | 274 | list_for_each_entry(p, &client->ports_list_head, list) { |
|---|
| 292 | 275 | if (p->addr.port == port) { |
|---|
| 293 | 276 | /* ok found. delete from the list at first */ |
|---|
| .. | .. |
|---|
| 297 | 280 | break; |
|---|
| 298 | 281 | } |
|---|
| 299 | 282 | } |
|---|
| 300 | | - write_unlock_irqrestore(&client->ports_lock, flags); |
|---|
| 283 | + write_unlock_irq(&client->ports_lock); |
|---|
| 301 | 284 | mutex_unlock(&client->ports_mutex); |
|---|
| 302 | 285 | if (found) |
|---|
| 303 | 286 | return port_delete(client, found); |
|---|
| .. | .. |
|---|
| 308 | 291 | /* delete the all ports belonging to the given client */ |
|---|
| 309 | 292 | int snd_seq_delete_all_ports(struct snd_seq_client *client) |
|---|
| 310 | 293 | { |
|---|
| 311 | | - unsigned long flags; |
|---|
| 312 | 294 | struct list_head deleted_list; |
|---|
| 313 | 295 | struct snd_seq_client_port *port, *tmp; |
|---|
| 314 | 296 | |
|---|
| .. | .. |
|---|
| 316 | 298 | * clear the port list in the client data. |
|---|
| 317 | 299 | */ |
|---|
| 318 | 300 | mutex_lock(&client->ports_mutex); |
|---|
| 319 | | - write_lock_irqsave(&client->ports_lock, flags); |
|---|
| 301 | + write_lock_irq(&client->ports_lock); |
|---|
| 320 | 302 | if (! list_empty(&client->ports_list_head)) { |
|---|
| 321 | 303 | list_add(&deleted_list, &client->ports_list_head); |
|---|
| 322 | 304 | list_del_init(&client->ports_list_head); |
|---|
| .. | .. |
|---|
| 324 | 306 | INIT_LIST_HEAD(&deleted_list); |
|---|
| 325 | 307 | } |
|---|
| 326 | 308 | client->num_ports = 0; |
|---|
| 327 | | - write_unlock_irqrestore(&client->ports_lock, flags); |
|---|
| 309 | + write_unlock_irq(&client->ports_lock); |
|---|
| 328 | 310 | |
|---|
| 329 | 311 | /* remove each port in deleted_list */ |
|---|
| 330 | 312 | list_for_each_entry_safe(port, tmp, &deleted_list, list) { |
|---|