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 035/437] char/tlclk: convert to read/write iterators
Date
Signed-off-by: Jens Axboe <axboe@kernel.dk>
---
drivers/char/tlclk.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/char/tlclk.c b/drivers/char/tlclk.c
index 896a3550fba9..17a312cfe46a 100644
--- a/drivers/char/tlclk.c
+++ b/drivers/char/tlclk.c
@@ -240,9 +240,10 @@ static int tlclk_release(struct inode *inode, struct file *filp)
return 0;
}

-static ssize_t tlclk_read(struct file *filp, char __user *buf, size_t count,
- loff_t *f_pos)
+static ssize_t tlclk_read(struct kiocb *iocb, struct iov_iter *to)
{
+ size_t count = iov_iter_count(to);
+
if (count < sizeof(struct tlclk_alarms))
return -EIO;
if (mutex_lock_interruptible(&tlclk_mutex))
@@ -250,7 +251,7 @@ static ssize_t tlclk_read(struct file *filp, char __user *buf, size_t count,


wait_event_interruptible(wq, got_event);
- if (copy_to_user(buf, alarm_events, sizeof(struct tlclk_alarms))) {
+ if (!copy_to_iter_full(alarm_events, sizeof(struct tlclk_alarms), to)) {
mutex_unlock(&tlclk_mutex);
return -EFAULT;
}
@@ -263,7 +264,7 @@ static ssize_t tlclk_read(struct file *filp, char __user *buf, size_t count,
}

static const struct file_operations tlclk_fops = {
- .read = tlclk_read,
+ .read_iter = tlclk_read,
.open = tlclk_open,
.release = tlclk_release,
.llseek = noop_llseek,
--
2.43.0

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