[PATCH 063/437] sound/oss/dmasound: convert to read/write iterators

From: Jens Axboe
Date: Thu Apr 11 2024 - 11:53:03 EST


Signed-off-by: Jens Axboe <axboe@xxxxxxxxx>
---
sound/oss/dmasound/dmasound_core.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/sound/oss/dmasound/dmasound_core.c b/sound/oss/dmasound/dmasound_core.c
index 164335d3c200..c702a8c5c668 100644
--- a/sound/oss/dmasound/dmasound_core.c
+++ b/sound/oss/dmasound/dmasound_core.c
@@ -1334,15 +1334,15 @@ static int state_release(struct inode *inode, struct file *file)
return 0;
}

-static ssize_t state_read(struct file *file, char __user *buf, size_t count,
- loff_t *ppos)
+static ssize_t state_read(struct kiocb *iocb, struct iov_iter *to)
{
+ size_t count = iov_iter_count(to);
int n = state.len - state.ptr;
if (n > count)
n = count;
if (n <= 0)
return 0;
- if (copy_to_user(buf, &state.buf[state.ptr], n))
+ if (!copy_to_iter_full(&state.buf[state.ptr], n, to))
return -EFAULT;
state.ptr += n;
return n;
@@ -1351,7 +1351,7 @@ static ssize_t state_read(struct file *file, char __user *buf, size_t count,
static const struct file_operations state_fops = {
.owner = THIS_MODULE,
.llseek = no_llseek,
- .read = state_read,
+ .read_iter = state_read,
.open = state_open,
.release = state_release,
};
--
2.43.0