mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-04 04:06:26 +00:00
ALSA: pcm: Drop obsoleted PCM copy_user and copy_kernel ops
Finally all users have been converted to the new PCM copy ops, let's drop the obsoleted copy_kernel and copy_user ops completely. Link: https://lore.kernel.org/r/20230815190136.8987-26-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
parent
205d3e030a
commit
6c0217b110
@ -71,11 +71,6 @@ struct snd_pcm_ops {
|
|||||||
unsigned long pos, unsigned long bytes);
|
unsigned long pos, unsigned long bytes);
|
||||||
int (*copy)(struct snd_pcm_substream *substream, int channel,
|
int (*copy)(struct snd_pcm_substream *substream, int channel,
|
||||||
unsigned long pos, struct iov_iter *iter, unsigned long bytes);
|
unsigned long pos, struct iov_iter *iter, unsigned long bytes);
|
||||||
int (*copy_user)(struct snd_pcm_substream *substream, int channel,
|
|
||||||
unsigned long pos, void __user *buf,
|
|
||||||
unsigned long bytes);
|
|
||||||
int (*copy_kernel)(struct snd_pcm_substream *substream, int channel,
|
|
||||||
unsigned long pos, void *buf, unsigned long bytes);
|
|
||||||
struct page *(*page)(struct snd_pcm_substream *substream,
|
struct page *(*page)(struct snd_pcm_substream *substream,
|
||||||
unsigned long offset);
|
unsigned long offset);
|
||||||
int (*mmap)(struct snd_pcm_substream *substream, struct vm_area_struct *vma);
|
int (*mmap)(struct snd_pcm_substream *substream, struct vm_area_struct *vma);
|
||||||
|
@ -2031,19 +2031,6 @@ static int default_read_copy(struct snd_pcm_substream *substream,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* a wrapper for calling old copy_kernel or copy_user ops */
|
|
||||||
static int call_old_copy(struct snd_pcm_substream *substream,
|
|
||||||
int channel, unsigned long hwoff,
|
|
||||||
struct iov_iter *iter, unsigned long bytes)
|
|
||||||
{
|
|
||||||
if (iov_iter_is_kvec(iter))
|
|
||||||
return substream->ops->copy_kernel(substream, channel, hwoff,
|
|
||||||
iter_iov_addr(iter), bytes);
|
|
||||||
else
|
|
||||||
return substream->ops->copy_user(substream, channel, hwoff,
|
|
||||||
iter_iov_addr(iter), bytes);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* call transfer with the filled iov_iter */
|
/* call transfer with the filled iov_iter */
|
||||||
static int do_transfer(struct snd_pcm_substream *substream, int c,
|
static int do_transfer(struct snd_pcm_substream *substream, int c,
|
||||||
unsigned long hwoff, void *data, unsigned long bytes,
|
unsigned long hwoff, void *data, unsigned long bytes,
|
||||||
@ -2147,7 +2134,7 @@ static int pcm_sanity_check(struct snd_pcm_substream *substream)
|
|||||||
if (PCM_RUNTIME_CHECK(substream))
|
if (PCM_RUNTIME_CHECK(substream))
|
||||||
return -ENXIO;
|
return -ENXIO;
|
||||||
runtime = substream->runtime;
|
runtime = substream->runtime;
|
||||||
if (snd_BUG_ON(!substream->ops->copy && !substream->ops->copy_user && !runtime->dma_area))
|
if (snd_BUG_ON(!substream->ops->copy && !runtime->dma_area))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
if (runtime->state == SNDRV_PCM_STATE_OPEN)
|
if (runtime->state == SNDRV_PCM_STATE_OPEN)
|
||||||
return -EBADFD;
|
return -EBADFD;
|
||||||
@ -2255,9 +2242,6 @@ snd_pcm_sframes_t __snd_pcm_lib_xfer(struct snd_pcm_substream *substream,
|
|||||||
} else {
|
} else {
|
||||||
if (substream->ops->copy)
|
if (substream->ops->copy)
|
||||||
transfer = substream->ops->copy;
|
transfer = substream->ops->copy;
|
||||||
else if ((in_kernel && substream->ops->copy_kernel) ||
|
|
||||||
(!in_kernel && substream->ops->copy_user))
|
|
||||||
transfer = call_old_copy;
|
|
||||||
else
|
else
|
||||||
transfer = is_playback ?
|
transfer = is_playback ?
|
||||||
default_write_copy : default_read_copy;
|
default_write_copy : default_read_copy;
|
||||||
|
@ -809,7 +809,7 @@ static int snd_pcm_hw_params(struct snd_pcm_substream *substream,
|
|||||||
runtime->boundary *= 2;
|
runtime->boundary *= 2;
|
||||||
|
|
||||||
/* clear the buffer for avoiding possible kernel info leaks */
|
/* clear the buffer for avoiding possible kernel info leaks */
|
||||||
if (runtime->dma_area && !substream->ops->copy && !substream->ops->copy_user) {
|
if (runtime->dma_area && !substream->ops->copy) {
|
||||||
size_t size = runtime->dma_bytes;
|
size_t size = runtime->dma_bytes;
|
||||||
|
|
||||||
if (runtime->info & SNDRV_PCM_INFO_MMAP)
|
if (runtime->info & SNDRV_PCM_INFO_MMAP)
|
||||||
|
Loading…
Reference in New Issue
Block a user