mirror of
https://github.com/torvalds/linux
synced 2024-09-06 18:01:05 +00:00
ALSA: ump: Fill group names for legacy rawmidi substreams
To make it clearer which legacy substream corresponds to which UMP
group, fill the subname field of each substream object with the group
number and the endpoint name, e.g. "Group 1 (My Device)".
Ideally speaking, we should have some better link information to the
derived UMP, but it's another feature extension.
Fixes: 0b5288f5fe
("ALSA: ump: Add legacy raw MIDI support")
Link: https://lore.kernel.org/r/20230824075108.29958-3-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
parent
5f11dd938f
commit
1761f4cc11
|
@ -1123,6 +1123,16 @@ static void process_legacy_input(struct snd_ump_endpoint *ump, const u32 *src,
|
||||||
spin_unlock_irqrestore(&ump->legacy_locks[dir], flags);
|
spin_unlock_irqrestore(&ump->legacy_locks[dir], flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void fill_substream_names(struct snd_ump_endpoint *ump,
|
||||||
|
struct snd_rawmidi *rmidi, int dir)
|
||||||
|
{
|
||||||
|
struct snd_rawmidi_substream *s;
|
||||||
|
|
||||||
|
list_for_each_entry(s, &rmidi->streams[dir].substreams, list)
|
||||||
|
snprintf(s->name, sizeof(s->name), "Group %d (%s)",
|
||||||
|
s->number + 1, ump->info.name);
|
||||||
|
}
|
||||||
|
|
||||||
int snd_ump_attach_legacy_rawmidi(struct snd_ump_endpoint *ump,
|
int snd_ump_attach_legacy_rawmidi(struct snd_ump_endpoint *ump,
|
||||||
char *id, int device)
|
char *id, int device)
|
||||||
{
|
{
|
||||||
|
@ -1156,6 +1166,11 @@ int snd_ump_attach_legacy_rawmidi(struct snd_ump_endpoint *ump,
|
||||||
rmidi->ops = &snd_ump_legacy_ops;
|
rmidi->ops = &snd_ump_legacy_ops;
|
||||||
rmidi->private_data = ump;
|
rmidi->private_data = ump;
|
||||||
ump->legacy_rmidi = rmidi;
|
ump->legacy_rmidi = rmidi;
|
||||||
|
if (input)
|
||||||
|
fill_substream_names(ump, rmidi, SNDRV_RAWMIDI_STREAM_INPUT);
|
||||||
|
if (output)
|
||||||
|
fill_substream_names(ump, rmidi, SNDRV_RAWMIDI_STREAM_OUTPUT);
|
||||||
|
|
||||||
ump_dbg(ump, "Created a legacy rawmidi #%d (%s)\n", device, id);
|
ump_dbg(ump, "Created a legacy rawmidi #%d (%s)\n", device, id);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue