Skip to content

Commit 9b5f8ee

Browse files
committed
ALSA: sh: Use standard helper for buffer accesses
The SH DAC audio driver uses the kmalloc'ed buffer as the main PCM buffer, and the data is transferred via hrtimer callbacks manually from there to the hardware. Meanwhile, some of its code are written as if the buffer is on iomem and use the special helpers for the iomem (e.g. copy_from_iter_toio() or memset_io()). Those are rather useless and the standard helpers should be used. Similarly, the PCM mmap callback is set to a special one with snd_pcm_lib_mmap_iomem, but this is also nonsense, because SH architecture doesn't support this function, hence it leads just to NULL -- the fallback to the standard helper. This patch replaces those special setups with the standard ones. Reported-by: kernel test robot <[email protected]> Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/ Link: https://patch.msgid.link/[email protected] Signed-off-by: Takashi Iwai <[email protected]>
1 parent 4f9d674 commit 9b5f8ee

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

sound/sh/sh_dac_audio.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ static int snd_sh_dac_pcm_copy(struct snd_pcm_substream *substream,
163163
/* channel is not used (interleaved data) */
164164
struct snd_sh_dac *chip = snd_pcm_substream_chip(substream);
165165

166-
if (copy_from_iter_toio(chip->data_buffer + pos, src, count))
166+
if (copy_from_iter(chip->data_buffer + pos, src, count) != count)
167167
return -EFAULT;
168168
chip->buffer_end = chip->data_buffer + pos + count;
169169

@@ -182,7 +182,7 @@ static int snd_sh_dac_pcm_silence(struct snd_pcm_substream *substream,
182182
/* channel is not used (interleaved data) */
183183
struct snd_sh_dac *chip = snd_pcm_substream_chip(substream);
184184

185-
memset_io(chip->data_buffer + pos, 0, count);
185+
memset(chip->data_buffer + pos, 0, count);
186186
chip->buffer_end = chip->data_buffer + pos + count;
187187

188188
if (chip->empty) {
@@ -211,7 +211,6 @@ static const struct snd_pcm_ops snd_sh_dac_pcm_ops = {
211211
.pointer = snd_sh_dac_pcm_pointer,
212212
.copy = snd_sh_dac_pcm_copy,
213213
.fill_silence = snd_sh_dac_pcm_silence,
214-
.mmap = snd_pcm_lib_mmap_iomem,
215214
};
216215

217216
static int snd_sh_dac_pcm(struct snd_sh_dac *chip, int device)

0 commit comments

Comments
 (0)