ALSA: rme32: Convert to generic PCM copy ops
This patch converts the rme32 driver code to use the new unified PCM copy callback. It's a straightforward conversion from *_user() to *_iter() variants. Link: https://lore.kernel.org/r/20230815190136.8987-11-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
parent
75bd8e3f4c
commit
50496aa216
@ -252,48 +252,24 @@ static int snd_rme32_playback_silence(struct snd_pcm_substream *substream,
|
|||||||
/* copy callback for halfduplex mode */
|
/* copy callback for halfduplex mode */
|
||||||
static int snd_rme32_playback_copy(struct snd_pcm_substream *substream,
|
static int snd_rme32_playback_copy(struct snd_pcm_substream *substream,
|
||||||
int channel, unsigned long pos,
|
int channel, unsigned long pos,
|
||||||
void __user *src, unsigned long count)
|
struct iov_iter *src, unsigned long count)
|
||||||
{
|
{
|
||||||
struct rme32 *rme32 = snd_pcm_substream_chip(substream);
|
struct rme32 *rme32 = snd_pcm_substream_chip(substream);
|
||||||
|
|
||||||
if (copy_from_user_toio(rme32->iobase + RME32_IO_DATA_BUFFER + pos,
|
return copy_from_iter_toio(rme32->iobase + RME32_IO_DATA_BUFFER + pos,
|
||||||
src, count))
|
src, count);
|
||||||
return -EFAULT;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int snd_rme32_playback_copy_kernel(struct snd_pcm_substream *substream,
|
|
||||||
int channel, unsigned long pos,
|
|
||||||
void *src, unsigned long count)
|
|
||||||
{
|
|
||||||
struct rme32 *rme32 = snd_pcm_substream_chip(substream);
|
|
||||||
|
|
||||||
memcpy_toio(rme32->iobase + RME32_IO_DATA_BUFFER + pos, src, count);
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* copy callback for halfduplex mode */
|
/* copy callback for halfduplex mode */
|
||||||
static int snd_rme32_capture_copy(struct snd_pcm_substream *substream,
|
static int snd_rme32_capture_copy(struct snd_pcm_substream *substream,
|
||||||
int channel, unsigned long pos,
|
int channel, unsigned long pos,
|
||||||
void __user *dst, unsigned long count)
|
struct iov_iter *dst, unsigned long count)
|
||||||
{
|
{
|
||||||
struct rme32 *rme32 = snd_pcm_substream_chip(substream);
|
struct rme32 *rme32 = snd_pcm_substream_chip(substream);
|
||||||
|
|
||||||
if (copy_to_user_fromio(dst,
|
return copy_to_iter_fromio(dst,
|
||||||
rme32->iobase + RME32_IO_DATA_BUFFER + pos,
|
rme32->iobase + RME32_IO_DATA_BUFFER + pos,
|
||||||
count))
|
count);
|
||||||
return -EFAULT;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int snd_rme32_capture_copy_kernel(struct snd_pcm_substream *substream,
|
|
||||||
int channel, unsigned long pos,
|
|
||||||
void *dst, unsigned long count)
|
|
||||||
{
|
|
||||||
struct rme32 *rme32 = snd_pcm_substream_chip(substream);
|
|
||||||
|
|
||||||
memcpy_fromio(dst, rme32->iobase + RME32_IO_DATA_BUFFER + pos, count);
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1194,8 +1170,7 @@ static const struct snd_pcm_ops snd_rme32_playback_spdif_ops = {
|
|||||||
.prepare = snd_rme32_playback_prepare,
|
.prepare = snd_rme32_playback_prepare,
|
||||||
.trigger = snd_rme32_pcm_trigger,
|
.trigger = snd_rme32_pcm_trigger,
|
||||||
.pointer = snd_rme32_playback_pointer,
|
.pointer = snd_rme32_playback_pointer,
|
||||||
.copy_user = snd_rme32_playback_copy,
|
.copy = snd_rme32_playback_copy,
|
||||||
.copy_kernel = snd_rme32_playback_copy_kernel,
|
|
||||||
.fill_silence = snd_rme32_playback_silence,
|
.fill_silence = snd_rme32_playback_silence,
|
||||||
.mmap = snd_pcm_lib_mmap_iomem,
|
.mmap = snd_pcm_lib_mmap_iomem,
|
||||||
};
|
};
|
||||||
@ -1207,8 +1182,7 @@ static const struct snd_pcm_ops snd_rme32_capture_spdif_ops = {
|
|||||||
.prepare = snd_rme32_capture_prepare,
|
.prepare = snd_rme32_capture_prepare,
|
||||||
.trigger = snd_rme32_pcm_trigger,
|
.trigger = snd_rme32_pcm_trigger,
|
||||||
.pointer = snd_rme32_capture_pointer,
|
.pointer = snd_rme32_capture_pointer,
|
||||||
.copy_user = snd_rme32_capture_copy,
|
.copy = snd_rme32_capture_copy,
|
||||||
.copy_kernel = snd_rme32_capture_copy_kernel,
|
|
||||||
.mmap = snd_pcm_lib_mmap_iomem,
|
.mmap = snd_pcm_lib_mmap_iomem,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1219,8 +1193,7 @@ static const struct snd_pcm_ops snd_rme32_playback_adat_ops = {
|
|||||||
.prepare = snd_rme32_playback_prepare,
|
.prepare = snd_rme32_playback_prepare,
|
||||||
.trigger = snd_rme32_pcm_trigger,
|
.trigger = snd_rme32_pcm_trigger,
|
||||||
.pointer = snd_rme32_playback_pointer,
|
.pointer = snd_rme32_playback_pointer,
|
||||||
.copy_user = snd_rme32_playback_copy,
|
.copy = snd_rme32_playback_copy,
|
||||||
.copy_kernel = snd_rme32_playback_copy_kernel,
|
|
||||||
.fill_silence = snd_rme32_playback_silence,
|
.fill_silence = snd_rme32_playback_silence,
|
||||||
.mmap = snd_pcm_lib_mmap_iomem,
|
.mmap = snd_pcm_lib_mmap_iomem,
|
||||||
};
|
};
|
||||||
@ -1232,8 +1205,7 @@ static const struct snd_pcm_ops snd_rme32_capture_adat_ops = {
|
|||||||
.prepare = snd_rme32_capture_prepare,
|
.prepare = snd_rme32_capture_prepare,
|
||||||
.trigger = snd_rme32_pcm_trigger,
|
.trigger = snd_rme32_pcm_trigger,
|
||||||
.pointer = snd_rme32_capture_pointer,
|
.pointer = snd_rme32_capture_pointer,
|
||||||
.copy_user = snd_rme32_capture_copy,
|
.copy = snd_rme32_capture_copy,
|
||||||
.copy_kernel = snd_rme32_capture_copy_kernel,
|
|
||||||
.mmap = snd_pcm_lib_mmap_iomem,
|
.mmap = snd_pcm_lib_mmap_iomem,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user