Skip to content

Commit 10a29de

Browse files
committed
ALSA: seq: Allow system notification in atomic
Currently the system notification helper assumes only the non-atomic delivery. For allowing an event delivery in non-atomic context, add the atomic flag to the helper function. This is a preliminary change for the support of UMP EP/FB notification. Signed-off-by: Takashi Iwai <[email protected]> Link: https://patch.msgid.link/[email protected]
1 parent aca5653 commit 10a29de

File tree

3 files changed

+19
-13
lines changed

3 files changed

+19
-13
lines changed

sound/core/seq/seq_clientmgr.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1476,7 +1476,7 @@ int snd_seq_client_notify_subscription(int client, int port,
14761476
event.data.connect.dest = info->dest;
14771477
event.data.connect.sender = info->sender;
14781478

1479-
return snd_seq_system_notify(client, port, &event); /* non-atomic */
1479+
return snd_seq_system_notify(client, port, &event, false); /* non-atomic */
14801480
}
14811481

14821482

sound/core/seq/seq_system.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,26 +78,27 @@ static int setheader(struct snd_seq_event * ev, int client, int port)
7878

7979

8080
/* entry points for broadcasting system events */
81-
void snd_seq_system_broadcast(int client, int port, int type)
81+
void snd_seq_system_broadcast(int client, int port, int type, bool atomic)
8282
{
8383
struct snd_seq_event ev;
8484

8585
if (setheader(&ev, client, port) < 0)
8686
return;
8787
ev.type = type;
88-
snd_seq_kernel_client_dispatch(sysclient, &ev, 0, 0);
88+
snd_seq_kernel_client_dispatch(sysclient, &ev, atomic, 0);
8989
}
9090
EXPORT_SYMBOL_GPL(snd_seq_system_broadcast);
9191

9292
/* entry points for broadcasting system events */
93-
int snd_seq_system_notify(int client, int port, struct snd_seq_event *ev)
93+
int snd_seq_system_notify(int client, int port, struct snd_seq_event *ev,
94+
bool atomic)
9495
{
9596
ev->flags = SNDRV_SEQ_EVENT_LENGTH_FIXED;
9697
ev->source.client = sysclient;
9798
ev->source.port = announce_port;
9899
ev->dest.client = client;
99100
ev->dest.port = port;
100-
return snd_seq_kernel_client_dispatch(sysclient, ev, 0, 0);
101+
return snd_seq_kernel_client_dispatch(sysclient, ev, atomic, 0);
101102
}
102103

103104
/* call-back handler for timer events */

sound/core/seq/seq_system.h

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,21 @@
1010

1111

1212
/* entry points for broadcasting system events */
13-
void snd_seq_system_broadcast(int client, int port, int type);
13+
void snd_seq_system_broadcast(int client, int port, int type, bool atomic);
1414

15-
#define snd_seq_system_client_ev_client_start(client) snd_seq_system_broadcast(client, 0, SNDRV_SEQ_EVENT_CLIENT_START)
16-
#define snd_seq_system_client_ev_client_exit(client) snd_seq_system_broadcast(client, 0, SNDRV_SEQ_EVENT_CLIENT_EXIT)
17-
#define snd_seq_system_client_ev_client_change(client) snd_seq_system_broadcast(client, 0, SNDRV_SEQ_EVENT_CLIENT_CHANGE)
18-
#define snd_seq_system_client_ev_port_start(client, port) snd_seq_system_broadcast(client, port, SNDRV_SEQ_EVENT_PORT_START)
19-
#define snd_seq_system_client_ev_port_exit(client, port) snd_seq_system_broadcast(client, port, SNDRV_SEQ_EVENT_PORT_EXIT)
20-
#define snd_seq_system_client_ev_port_change(client, port) snd_seq_system_broadcast(client, port, SNDRV_SEQ_EVENT_PORT_CHANGE)
15+
/* normal system notification event broadcast */
16+
#define notify_event(client, port, type) \
17+
snd_seq_system_broadcast(client, port, type, false)
2118

22-
int snd_seq_system_notify(int client, int port, struct snd_seq_event *ev);
19+
#define snd_seq_system_client_ev_client_start(client) notify_event(client, 0, SNDRV_SEQ_EVENT_CLIENT_START)
20+
#define snd_seq_system_client_ev_client_exit(client) notify_event(client, 0, SNDRV_SEQ_EVENT_CLIENT_EXIT)
21+
#define snd_seq_system_client_ev_client_change(client) notify_event(client, 0, SNDRV_SEQ_EVENT_CLIENT_CHANGE)
22+
#define snd_seq_system_client_ev_port_start(client, port) notify_event(client, port, SNDRV_SEQ_EVENT_PORT_START)
23+
#define snd_seq_system_client_ev_port_exit(client, port) notify_event(client, port, SNDRV_SEQ_EVENT_PORT_EXIT)
24+
#define snd_seq_system_client_ev_port_change(client, port) notify_event(client, port, SNDRV_SEQ_EVENT_PORT_CHANGE)
25+
26+
int snd_seq_system_notify(int client, int port, struct snd_seq_event *ev,
27+
bool atomic);
2328

2429
/* register our internal client */
2530
int snd_seq_system_client_init(void);

0 commit comments

Comments
 (0)