lkml.org 
[lkml]   [2024]   [Apr]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 384/437] stm class: convert to read/write iterators
Date
Signed-off-by: Jens Axboe <axboe@kernel.dk>
---
drivers/hwtracing/stm/core.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/hwtracing/stm/core.c b/drivers/hwtracing/stm/core.c
index 534fbefc7f6a..c66f1864adcd 100644
--- a/drivers/hwtracing/stm/core.c
+++ b/drivers/hwtracing/stm/core.c
@@ -615,11 +615,11 @@ stm_write(struct stm_device *stm, struct stm_output *output,
return err;
}

-static ssize_t stm_char_write(struct file *file, const char __user *buf,
- size_t count, loff_t *ppos)
+static ssize_t stm_char_write(struct kiocb *iocb, struct iov_iter *from)
{
- struct stm_file *stmf = file->private_data;
+ struct stm_file *stmf = iocb->ki_filp->private_data;
struct stm_device *stm = stmf->stm;
+ size_t count = iov_iter_count(from);
char *kbuf;
int err;

@@ -649,7 +649,7 @@ static ssize_t stm_char_write(struct file *file, const char __user *buf,
if (!kbuf)
return -ENOMEM;

- err = copy_from_user(kbuf, buf, count);
+ err = !copy_from_iter_full(kbuf, count, from);
if (err) {
kfree(kbuf);
return -EFAULT;
@@ -835,7 +835,7 @@ stm_char_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
static const struct file_operations stm_fops = {
.open = stm_char_open,
.release = stm_char_release,
- .write = stm_char_write,
+ .write_iter = stm_char_write,
.mmap = stm_char_mmap,
.unlocked_ioctl = stm_char_ioctl,
.compat_ioctl = compat_ptr_ioctl,
--
2.43.0

\
 
 \ /
  Last update: 2024-05-27 16:36    [W:1.377 / U:3.704 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site