diff options
Diffstat (limited to 'sound')
-rw-r--r-- | sound/core/pcm_native.c | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c index 891d7140553c..37b4b10850ae 100644 --- a/sound/core/pcm_native.c +++ b/sound/core/pcm_native.c | |||
@@ -2852,8 +2852,8 @@ static ssize_t snd_pcm_write(struct file *file, const char __user *buf, | |||
2852 | return result; | 2852 | return result; |
2853 | } | 2853 | } |
2854 | 2854 | ||
2855 | static ssize_t snd_pcm_readv(struct file *file, const struct iovec *_vector, | 2855 | static ssize_t snd_pcm_aio_read(struct kiocb *iocb, const struct iovec *iov, |
2856 | unsigned long count, loff_t * offset) | 2856 | unsigned long nr_segs, loff_t pos) |
2857 | 2857 | ||
2858 | { | 2858 | { |
2859 | struct snd_pcm_file *pcm_file; | 2859 | struct snd_pcm_file *pcm_file; |
@@ -2864,22 +2864,22 @@ static ssize_t snd_pcm_readv(struct file *file, const struct iovec *_vector, | |||
2864 | void __user **bufs; | 2864 | void __user **bufs; |
2865 | snd_pcm_uframes_t frames; | 2865 | snd_pcm_uframes_t frames; |
2866 | 2866 | ||
2867 | pcm_file = file->private_data; | 2867 | pcm_file = iocb->ki_filp->private_data; |
2868 | substream = pcm_file->substream; | 2868 | substream = pcm_file->substream; |
2869 | snd_assert(substream != NULL, return -ENXIO); | 2869 | snd_assert(substream != NULL, return -ENXIO); |
2870 | runtime = substream->runtime; | 2870 | runtime = substream->runtime; |
2871 | if (runtime->status->state == SNDRV_PCM_STATE_OPEN) | 2871 | if (runtime->status->state == SNDRV_PCM_STATE_OPEN) |
2872 | return -EBADFD; | 2872 | return -EBADFD; |
2873 | if (count > 1024 || count != runtime->channels) | 2873 | if (nr_segs > 1024 || nr_segs != runtime->channels) |
2874 | return -EINVAL; | 2874 | return -EINVAL; |
2875 | if (!frame_aligned(runtime, _vector->iov_len)) | 2875 | if (!frame_aligned(runtime, iov->iov_len)) |
2876 | return -EINVAL; | 2876 | return -EINVAL; |
2877 | frames = bytes_to_samples(runtime, _vector->iov_len); | 2877 | frames = bytes_to_samples(runtime, iov->iov_len); |
2878 | bufs = kmalloc(sizeof(void *) * count, GFP_KERNEL); | 2878 | bufs = kmalloc(sizeof(void *) * nr_segs, GFP_KERNEL); |
2879 | if (bufs == NULL) | 2879 | if (bufs == NULL) |
2880 | return -ENOMEM; | 2880 | return -ENOMEM; |
2881 | for (i = 0; i < count; ++i) | 2881 | for (i = 0; i < nr_segs; ++i) |
2882 | bufs[i] = _vector[i].iov_base; | 2882 | bufs[i] = iov[i].iov_base; |
2883 | result = snd_pcm_lib_readv(substream, bufs, frames); | 2883 | result = snd_pcm_lib_readv(substream, bufs, frames); |
2884 | if (result > 0) | 2884 | if (result > 0) |
2885 | result = frames_to_bytes(runtime, result); | 2885 | result = frames_to_bytes(runtime, result); |
@@ -2887,8 +2887,8 @@ static ssize_t snd_pcm_readv(struct file *file, const struct iovec *_vector, | |||
2887 | return result; | 2887 | return result; |
2888 | } | 2888 | } |
2889 | 2889 | ||
2890 | static ssize_t snd_pcm_writev(struct file *file, const struct iovec *_vector, | 2890 | static ssize_t snd_pcm_aio_write(struct kiocb *iocb, const struct iovec *iov, |
2891 | unsigned long count, loff_t * offset) | 2891 | unsigned long nr_segs, loff_t pos) |
2892 | { | 2892 | { |
2893 | struct snd_pcm_file *pcm_file; | 2893 | struct snd_pcm_file *pcm_file; |
2894 | struct snd_pcm_substream *substream; | 2894 | struct snd_pcm_substream *substream; |
@@ -2898,7 +2898,7 @@ static ssize_t snd_pcm_writev(struct file *file, const struct iovec *_vector, | |||
2898 | void __user **bufs; | 2898 | void __user **bufs; |
2899 | snd_pcm_uframes_t frames; | 2899 | snd_pcm_uframes_t frames; |
2900 | 2900 | ||
2901 | pcm_file = file->private_data; | 2901 | pcm_file = iocb->ki_filp->private_data; |
2902 | substream = pcm_file->substream; | 2902 | substream = pcm_file->substream; |
2903 | snd_assert(substream != NULL, result = -ENXIO; goto end); | 2903 | snd_assert(substream != NULL, result = -ENXIO; goto end); |
2904 | runtime = substream->runtime; | 2904 | runtime = substream->runtime; |
@@ -2906,17 +2906,17 @@ static ssize_t snd_pcm_writev(struct file *file, const struct iovec *_vector, | |||
2906 | result = -EBADFD; | 2906 | result = -EBADFD; |
2907 | goto end; | 2907 | goto end; |
2908 | } | 2908 | } |
2909 | if (count > 128 || count != runtime->channels || | 2909 | if (nr_segs > 128 || nr_segs != runtime->channels || |
2910 | !frame_aligned(runtime, _vector->iov_len)) { | 2910 | !frame_aligned(runtime, iov->iov_len)) { |
2911 | result = -EINVAL; | 2911 | result = -EINVAL; |
2912 | goto end; | 2912 | goto end; |
2913 | } | 2913 | } |
2914 | frames = bytes_to_samples(runtime, _vector->iov_len); | 2914 | frames = bytes_to_samples(runtime, iov->iov_len); |
2915 | bufs = kmalloc(sizeof(void *) * count, GFP_KERNEL); | 2915 | bufs = kmalloc(sizeof(void *) * nr_segs, GFP_KERNEL); |
2916 | if (bufs == NULL) | 2916 | if (bufs == NULL) |
2917 | return -ENOMEM; | 2917 | return -ENOMEM; |
2918 | for (i = 0; i < count; ++i) | 2918 | for (i = 0; i < nr_segs; ++i) |
2919 | bufs[i] = _vector[i].iov_base; | 2919 | bufs[i] = iov[i].iov_base; |
2920 | result = snd_pcm_lib_writev(substream, bufs, frames); | 2920 | result = snd_pcm_lib_writev(substream, bufs, frames); |
2921 | if (result > 0) | 2921 | if (result > 0) |
2922 | result = frames_to_bytes(runtime, result); | 2922 | result = frames_to_bytes(runtime, result); |
@@ -3426,7 +3426,7 @@ struct file_operations snd_pcm_f_ops[2] = { | |||
3426 | { | 3426 | { |
3427 | .owner = THIS_MODULE, | 3427 | .owner = THIS_MODULE, |
3428 | .write = snd_pcm_write, | 3428 | .write = snd_pcm_write, |
3429 | .writev = snd_pcm_writev, | 3429 | .aio_write = snd_pcm_aio_write, |
3430 | .open = snd_pcm_playback_open, | 3430 | .open = snd_pcm_playback_open, |
3431 | .release = snd_pcm_release, | 3431 | .release = snd_pcm_release, |
3432 | .poll = snd_pcm_playback_poll, | 3432 | .poll = snd_pcm_playback_poll, |
@@ -3438,7 +3438,7 @@ struct file_operations snd_pcm_f_ops[2] = { | |||
3438 | { | 3438 | { |
3439 | .owner = THIS_MODULE, | 3439 | .owner = THIS_MODULE, |
3440 | .read = snd_pcm_read, | 3440 | .read = snd_pcm_read, |
3441 | .readv = snd_pcm_readv, | 3441 | .aio_read = snd_pcm_aio_read, |
3442 | .open = snd_pcm_capture_open, | 3442 | .open = snd_pcm_capture_open, |
3443 | .release = snd_pcm_release, | 3443 | .release = snd_pcm_release, |
3444 | .poll = snd_pcm_capture_poll, | 3444 | .poll = snd_pcm_capture_poll, |