]> www.infradead.org Git - users/hch/misc.git/commitdiff
ALSA: seq: Allow system notification in atomic
authorTakashi Iwai <tiwai@suse.de>
Fri, 10 Jan 2025 15:59:40 +0000 (16:59 +0100)
committerTakashi Iwai <tiwai@suse.de>
Sun, 12 Jan 2025 12:12:21 +0000 (13:12 +0100)
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 <tiwai@suse.de>
Link: https://patch.msgid.link/20250110155943.31578-8-tiwai@suse.de
sound/core/seq/seq_clientmgr.c
sound/core/seq/seq_system.c
sound/core/seq/seq_system.h

index fe2d7f90161061620a67d22010f3696dbc89919a..3d27f777f29ebfada2cb21dd76f685115b1608ba 100644 (file)
@@ -1476,7 +1476,7 @@ int snd_seq_client_notify_subscription(int client, int port,
        event.data.connect.dest = info->dest;
        event.data.connect.sender = info->sender;
 
-       return snd_seq_system_notify(client, port, &event);  /* non-atomic */
+       return snd_seq_system_notify(client, port, &event, false);  /* non-atomic */
 }
 
 
index 37edcc3881ed688ffffa535203fc86e6c6ec3f1a..853920f79016dfc66955414b7b87f058517b407f 100644 (file)
@@ -78,26 +78,27 @@ static int setheader(struct snd_seq_event * ev, int client, int port)
 
 
 /* entry points for broadcasting system events */
-void snd_seq_system_broadcast(int client, int port, int type)
+void snd_seq_system_broadcast(int client, int port, int type, bool atomic)
 {
        struct snd_seq_event ev;
        
        if (setheader(&ev, client, port) < 0)
                return;
        ev.type = type;
-       snd_seq_kernel_client_dispatch(sysclient, &ev, 0, 0);
+       snd_seq_kernel_client_dispatch(sysclient, &ev, atomic, 0);
 }
 EXPORT_SYMBOL_GPL(snd_seq_system_broadcast);
 
 /* entry points for broadcasting system events */
-int snd_seq_system_notify(int client, int port, struct snd_seq_event *ev)
+int snd_seq_system_notify(int client, int port, struct snd_seq_event *ev,
+                         bool atomic)
 {
        ev->flags = SNDRV_SEQ_EVENT_LENGTH_FIXED;
        ev->source.client = sysclient;
        ev->source.port = announce_port;
        ev->dest.client = client;
        ev->dest.port = port;
-       return snd_seq_kernel_client_dispatch(sysclient, ev, 0, 0);
+       return snd_seq_kernel_client_dispatch(sysclient, ev, atomic, 0);
 }
 
 /* call-back handler for timer events */
index 4fe88ad403461d7befa5ab4a8906555ab64d5494..a118f7252b62a03e5bb571462d5748880b9fe50c 100644 (file)
 
 
 /* entry points for broadcasting system events */
-void snd_seq_system_broadcast(int client, int port, int type);
+void snd_seq_system_broadcast(int client, int port, int type, bool atomic);
 
-#define snd_seq_system_client_ev_client_start(client) snd_seq_system_broadcast(client, 0, SNDRV_SEQ_EVENT_CLIENT_START)
-#define snd_seq_system_client_ev_client_exit(client) snd_seq_system_broadcast(client, 0, SNDRV_SEQ_EVENT_CLIENT_EXIT)
-#define snd_seq_system_client_ev_client_change(client) snd_seq_system_broadcast(client, 0, SNDRV_SEQ_EVENT_CLIENT_CHANGE)
-#define snd_seq_system_client_ev_port_start(client, port) snd_seq_system_broadcast(client, port, SNDRV_SEQ_EVENT_PORT_START)
-#define snd_seq_system_client_ev_port_exit(client, port) snd_seq_system_broadcast(client, port, SNDRV_SEQ_EVENT_PORT_EXIT)
-#define snd_seq_system_client_ev_port_change(client, port) snd_seq_system_broadcast(client, port, SNDRV_SEQ_EVENT_PORT_CHANGE)
+/* normal system notification event broadcast */
+#define notify_event(client, port, type) \
+       snd_seq_system_broadcast(client, port, type, false)
 
-int snd_seq_system_notify(int client, int port, struct snd_seq_event *ev);
+#define snd_seq_system_client_ev_client_start(client) notify_event(client, 0, SNDRV_SEQ_EVENT_CLIENT_START)
+#define snd_seq_system_client_ev_client_exit(client) notify_event(client, 0, SNDRV_SEQ_EVENT_CLIENT_EXIT)
+#define snd_seq_system_client_ev_client_change(client) notify_event(client, 0, SNDRV_SEQ_EVENT_CLIENT_CHANGE)
+#define snd_seq_system_client_ev_port_start(client, port) notify_event(client, port, SNDRV_SEQ_EVENT_PORT_START)
+#define snd_seq_system_client_ev_port_exit(client, port) notify_event(client, port, SNDRV_SEQ_EVENT_PORT_EXIT)
+#define snd_seq_system_client_ev_port_change(client, port) notify_event(client, port, SNDRV_SEQ_EVENT_PORT_CHANGE)
+
+int snd_seq_system_notify(int client, int port, struct snd_seq_event *ev,
+                         bool atomic);
 
 /* register our internal client */
 int snd_seq_system_client_init(void);