[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240411153126.16201-36-axboe@kernel.dk>
Date: Thu, 11 Apr 2024 09:12:55 -0600
From: Jens Axboe <axboe@...nel.dk>
To: linux-kernel@...r.kernel.org
Cc: Jens Axboe <axboe@...nel.dk>
Subject: [PATCH 035/437] char/tlclk: convert to read/write iterators
Signed-off-by: Jens Axboe <axboe@...nel.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
Powered by blists - more mailing lists