Skip to content

Commit

Permalink
ALSA: pci: rme: Set up buffer type properly
Browse files Browse the repository at this point in the history
Although the regression of the mmap was fixed in the recent commit
dc0dc8a ("ALSA: pcm: Fix mmap breakage without explicit buffer
setup"), RME9652 and HDSP drivers have still potential issues with
their mmap handling.  Namely, they use the default mmap handler
without the standard buffer preallocation, and PCM core wouldn't use
the coherent DMA mapping.  It's practically OK on x86, but on some
exotic architectures, it wouldn't work.

This patch addresses the potential breakage by replacing the buffer
setup with the proper macro.  It also simplifies the source code,
too.

Link: https://lore.kernel.org/r/20210809071829.22238-3-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
  • Loading branch information
Takashi Iwai committed Aug 9, 2021
1 parent cbea6e5 commit 0899a7a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
6 changes: 2 additions & 4 deletions sound/pci/rme9652/hdsp.c
Original file line number Diff line number Diff line change
Expand Up @@ -4507,8 +4507,7 @@ static int snd_hdsp_playback_open(struct snd_pcm_substream *substream)
snd_pcm_set_sync(substream);

runtime->hw = snd_hdsp_playback_subinfo;
runtime->dma_area = hdsp->playback_buffer;
runtime->dma_bytes = HDSP_DMA_AREA_BYTES;
snd_pcm_set_runtime_buffer(substream, hdsp->playback_dma_buf);

hdsp->playback_pid = current->pid;
hdsp->playback_substream = substream;
Expand Down Expand Up @@ -4584,8 +4583,7 @@ static int snd_hdsp_capture_open(struct snd_pcm_substream *substream)
snd_pcm_set_sync(substream);

runtime->hw = snd_hdsp_capture_subinfo;
runtime->dma_area = hdsp->capture_buffer;
runtime->dma_bytes = HDSP_DMA_AREA_BYTES;
snd_pcm_set_runtime_buffer(substream, hdsp->capture_dma_buf);

hdsp->capture_pid = current->pid;
hdsp->capture_substream = substream;
Expand Down
6 changes: 2 additions & 4 deletions sound/pci/rme9652/rme9652.c
Original file line number Diff line number Diff line change
Expand Up @@ -2259,8 +2259,7 @@ static int snd_rme9652_playback_open(struct snd_pcm_substream *substream)
snd_pcm_set_sync(substream);

runtime->hw = snd_rme9652_playback_subinfo;
runtime->dma_area = rme9652->playback_buffer;
runtime->dma_bytes = RME9652_DMA_AREA_BYTES;
snd_pcm_set_runtime_buffer(substream, rme9652->playback_dma_buf);

if (rme9652->capture_substream == NULL) {
rme9652_stop(rme9652);
Expand Down Expand Up @@ -2319,8 +2318,7 @@ static int snd_rme9652_capture_open(struct snd_pcm_substream *substream)
snd_pcm_set_sync(substream);

runtime->hw = snd_rme9652_capture_subinfo;
runtime->dma_area = rme9652->capture_buffer;
runtime->dma_bytes = RME9652_DMA_AREA_BYTES;
snd_pcm_set_runtime_buffer(substream, rme9652->capture_dma_buf);

if (rme9652->playback_substream == NULL) {
rme9652_stop(rme9652);
Expand Down

0 comments on commit 0899a7a

Please sign in to comment.