diff mbox series

[4/6] ALSA: usb-audio: Update UMP group attributes for GTB blocks, too

Message ID 20240807092303.1935-5-tiwai@suse.de (mailing list archive)
State New, archived
Headers show
Series ALSA: Fixes for optional MIDI 1.0 port in MIDI 2.0 | expand

Commit Message

Takashi Iwai Aug. 7, 2024, 9:22 a.m. UTC
When a FB is created from a GTB instead of UMP FB Info inquiry, we
missed the update of the corresponding UMP Group attributes.
Export the call of updater and let it be called from the USB driver.

Fixes: 0642a3c5cacc ("ALSA: ump: Update substream name from assigned FB names")
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 include/sound/ump.h | 1 +
 sound/core/ump.c    | 9 +++++----
 sound/usb/midi2.c   | 2 ++
 3 files changed, 8 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/include/sound/ump.h b/include/sound/ump.h
index 7484f62fb234..532c2c3ea28e 100644
--- a/include/sound/ump.h
+++ b/include/sound/ump.h
@@ -123,6 +123,7 @@  static inline int snd_ump_attach_legacy_rawmidi(struct snd_ump_endpoint *ump,
 
 int snd_ump_receive_ump_val(struct snd_ump_endpoint *ump, u32 val);
 int snd_ump_switch_protocol(struct snd_ump_endpoint *ump, unsigned int protocol);
+void snd_ump_update_group_attrs(struct snd_ump_endpoint *ump);
 
 /*
  * Some definitions for UMP
diff --git a/sound/core/ump.c b/sound/core/ump.c
index 4502de891adf..243ecdbb2a6e 100644
--- a/sound/core/ump.c
+++ b/sound/core/ump.c
@@ -525,7 +525,7 @@  static void snd_ump_proc_read(struct snd_info_entry *entry,
 }
 
 /* update dir_bits and active flag for all groups in the client */
-static void update_group_attrs(struct snd_ump_endpoint *ump)
+void snd_ump_update_group_attrs(struct snd_ump_endpoint *ump)
 {
 	struct snd_ump_block *fb;
 	struct snd_ump_group *group;
@@ -578,6 +578,7 @@  static void update_group_attrs(struct snd_ump_endpoint *ump)
 		}
 	}
 }
+EXPORT_SYMBOL_GPL(snd_ump_update_group_attrs);
 
 /*
  * UMP endpoint and function block handling
@@ -863,7 +864,7 @@  static int ump_handle_fb_info_msg(struct snd_ump_endpoint *ump,
 	if (fb) {
 		fill_fb_info(ump, &fb->info, buf);
 		if (ump->parsed) {
-			update_group_attrs(ump);
+			snd_ump_update_group_attrs(ump);
 			seq_notify_fb_change(ump, fb);
 		}
 	}
@@ -895,7 +896,7 @@  static int ump_handle_fb_name_msg(struct snd_ump_endpoint *ump,
 				buf->raw, 3);
 	/* notify the FB name update to sequencer, too */
 	if (ret > 0 && ump->parsed) {
-		update_group_attrs(ump);
+		snd_ump_update_group_attrs(ump);
 		seq_notify_fb_change(ump, fb);
 	}
 	return ret;
@@ -1065,7 +1066,7 @@  int snd_ump_parse_endpoint(struct snd_ump_endpoint *ump)
 	}
 
 	/* initialize group attributions */
-	update_group_attrs(ump);
+	snd_ump_update_group_attrs(ump);
 
  error:
 	ump->parsed = true;
diff --git a/sound/usb/midi2.c b/sound/usb/midi2.c
index 4fb43d9743d7..692dfc3c182f 100644
--- a/sound/usb/midi2.c
+++ b/sound/usb/midi2.c
@@ -877,6 +877,8 @@  static int create_gtb_block(struct snd_usb_midi2_ump *rmidi, int dir, int blk)
 		}
 	}
 
+	snd_ump_update_group_attrs(rmidi->ump);
+
 	usb_audio_dbg(umidi->chip,
 		      "Created a UMP block %d from GTB, name=%s, flags=0x%x\n",
 		      blk, fb->info.name, fb->info.flags);