Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

+7
+1
include/uapi/sound/asequencer.h
··· 427 427 #define SNDRV_SEQ_PORT_CAP_SUBS_READ (1<<5) /* allow read subscription */ 428 428 #define SNDRV_SEQ_PORT_CAP_SUBS_WRITE (1<<6) /* allow write subscription */ 429 429 #define SNDRV_SEQ_PORT_CAP_NO_EXPORT (1<<7) /* routing not allowed */ 430 + #define SNDRV_SEQ_PORT_CAP_INACTIVE (1<<8) /* inactive port */ 430 431 431 432 /* port type */ 432 433 #define SNDRV_SEQ_PORT_TYPE_SPECIFIC (1<<0) /* hardware specific */
+2
sound/core/seq/seq_clientmgr.c
··· 2416 2416 2417 2417 mutex_lock(&client->ports_mutex); 2418 2418 list_for_each_entry(p, &client->ports_list_head, list) { 2419 + if (p->capability & SNDRV_SEQ_PORT_CAP_INACTIVE) 2420 + continue; 2419 2421 snd_iprintf(buffer, " Port %3d : \"%s\" (%c%c%c%c)\n", 2420 2422 p->addr.port, p->name, 2421 2423 FLAG_PERM_RD(p->capability),
+4
sound/core/seq/seq_ports.c
··· 69 69 { 70 70 int num; 71 71 struct snd_seq_client_port *port, *found; 72 + bool check_inactive = (pinfo->capability & SNDRV_SEQ_PORT_CAP_INACTIVE); 72 73 73 74 num = pinfo->addr.port; 74 75 found = NULL; 75 76 read_lock(&client->ports_lock); 76 77 list_for_each_entry(port, &client->ports_list_head, list) { 78 + if ((port->capability & SNDRV_SEQ_PORT_CAP_INACTIVE) && 79 + !check_inactive) 80 + continue; /* skip inactive ports */ 77 81 if (port->addr.port < num) 78 82 continue; 79 83 if (port->addr.port == num) {