summaryrefslogtreecommitdiff
path: root/sound/usb/proc.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2020-11-23 11:53:36 +0300
committerTakashi Iwai <tiwai@suse.de>2020-11-23 17:16:04 +0300
commit6aa719d15a1903eb3fd0e052ae53f3b024ad4d05 (patch)
tree026ff7427535388baf0850e848991c535c3bb0a1 /sound/usb/proc.c
parentd0f09d1e4a88647695739d2ff4268e9fdcf5b35d (diff)
downloadlinux-6aa719d15a1903eb3fd0e052ae53f3b024ad4d05.tar.xz
ALSA: usb-audio: Drop unneeded snd_usb_substream fields
Some fields like interface and alt_idx in snd_usb_substream are mostly useless now as they can be referred via either cur_audiofmt or data_endpoint assigned to the substream. Drop those, and also assure the concurrency about the access of cur_audiofmt field. Tested-by: Keith Milner <kamilner@superlative.org> Tested-by: Dylan Robinson <dylan_robinson@motu.com> Link: https://lore.kernel.org/r/20201123085347.19667-31-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/usb/proc.c')
-rw-r--r--sound/usb/proc.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/sound/usb/proc.c b/sound/usb/proc.c
index 889c550c9f29..447ba32e281c 100644
--- a/sound/usb/proc.c
+++ b/sound/usb/proc.c
@@ -175,32 +175,39 @@ static void proc_dump_ep_status(struct snd_usb_substream *subs,
}
}
-static void proc_dump_substream_status(struct snd_usb_substream *subs, struct snd_info_buffer *buffer)
+static void proc_dump_substream_status(struct snd_usb_audio *chip,
+ struct snd_usb_substream *subs,
+ struct snd_info_buffer *buffer)
{
+ mutex_lock(&chip->mutex);
if (subs->running) {
snd_iprintf(buffer, " Status: Running\n");
- snd_iprintf(buffer, " Interface = %d\n", subs->interface);
- snd_iprintf(buffer, " Altset = %d\n", subs->altset_idx);
+ if (subs->cur_audiofmt) {
+ snd_iprintf(buffer, " Interface = %d\n", subs->cur_audiofmt->iface);
+ snd_iprintf(buffer, " Altset = %d\n", subs->cur_audiofmt->altsetting);
+ }
proc_dump_ep_status(subs, subs->data_endpoint, subs->sync_endpoint, buffer);
} else {
snd_iprintf(buffer, " Status: Stop\n");
}
+ mutex_unlock(&chip->mutex);
}
static void proc_pcm_format_read(struct snd_info_entry *entry, struct snd_info_buffer *buffer)
{
struct snd_usb_stream *stream = entry->private_data;
+ struct snd_usb_audio *chip = stream->chip;
- snd_iprintf(buffer, "%s : %s\n", stream->chip->card->longname, stream->pcm->name);
+ snd_iprintf(buffer, "%s : %s\n", chip->card->longname, stream->pcm->name);
if (stream->substream[SNDRV_PCM_STREAM_PLAYBACK].num_formats) {
snd_iprintf(buffer, "\nPlayback:\n");
- proc_dump_substream_status(&stream->substream[SNDRV_PCM_STREAM_PLAYBACK], buffer);
+ proc_dump_substream_status(chip, &stream->substream[SNDRV_PCM_STREAM_PLAYBACK], buffer);
proc_dump_substream_formats(&stream->substream[SNDRV_PCM_STREAM_PLAYBACK], buffer);
}
if (stream->substream[SNDRV_PCM_STREAM_CAPTURE].num_formats) {
snd_iprintf(buffer, "\nCapture:\n");
- proc_dump_substream_status(&stream->substream[SNDRV_PCM_STREAM_CAPTURE], buffer);
+ proc_dump_substream_status(chip, &stream->substream[SNDRV_PCM_STREAM_CAPTURE], buffer);
proc_dump_substream_formats(&stream->substream[SNDRV_PCM_STREAM_CAPTURE], buffer);
}
}