summaryrefslogtreecommitdiff
path: root/sound/core/seq/seq_ports.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2023-05-23 10:53:47 +0300
committerTakashi Iwai <tiwai@suse.de>2023-05-23 13:11:23 +0300
commit74661932ac5ecb12e4378f41083be6ac17804e71 (patch)
treec1ca7e5720b036a65745005107dbfaf23dad02d8 /sound/core/seq/seq_ports.c
parent46397622a3fa8372b8fda0f04b33d16923b03b1b (diff)
downloadlinux-74661932ac5ecb12e4378f41083be6ac17804e71.tar.xz
ALSA: seq: Add port inactive flag
This extends the ALSA sequencer port capability bit to indicate the "inactive" flag. When this flag is set, the port is essentially invisible, and doesn't appear in the port query ioctls, while the direct access and the connection to this port are still allowed. The active/inactive state can be flipped dynamically, so that it can be visible at any time later. This feature is introduced basically for UMP; some UMP Groups in a UMP Block may be unassigned, hence those are practically invisible. On ALSA sequencer, the corresponding sequencer ports will get this new "inactive" flag to indicate the invisible state. Reviewed-by: Jaroslav Kysela <perex@perex.cz> Link: https://lore.kernel.org/r/20230523075358.9672-27-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/core/seq/seq_ports.c')
-rw-r--r--sound/core/seq/seq_ports.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/sound/core/seq/seq_ports.c b/sound/core/seq/seq_ports.c
index 500b1a5a9679..42f4172d4766 100644
--- a/sound/core/seq/seq_ports.c
+++ b/sound/core/seq/seq_ports.c
@@ -69,11 +69,15 @@ struct snd_seq_client_port *snd_seq_port_query_nearest(struct snd_seq_client *cl
{
int num;
struct snd_seq_client_port *port, *found;
+ bool check_inactive = (pinfo->capability & SNDRV_SEQ_PORT_CAP_INACTIVE);
num = pinfo->addr.port;
found = NULL;
read_lock(&client->ports_lock);
list_for_each_entry(port, &client->ports_list_head, list) {
+ if ((port->capability & SNDRV_SEQ_PORT_CAP_INACTIVE) &&
+ !check_inactive)
+ continue; /* skip inactive ports */
if (port->addr.port < num)
continue;
if (port->addr.port == num) {