[PATCH 255/437] watchdog: sc1200wdt: convert to read/write iterators

From: Jens Axboe
Date: Thu Apr 11 2024 - 12:38:41 EST


Signed-off-by: Jens Axboe <axboe@xxxxxxxxx>
---
drivers/watchdog/sc1200wdt.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/watchdog/sc1200wdt.c b/drivers/watchdog/sc1200wdt.c
index f22ebe89fe13..d8d8bee1d6d4 100644
--- a/drivers/watchdog/sc1200wdt.c
+++ b/drivers/watchdog/sc1200wdt.c
@@ -261,9 +261,9 @@ static int sc1200wdt_release(struct inode *inode, struct file *file)
}


-static ssize_t sc1200wdt_write(struct file *file, const char __user *data,
- size_t len, loff_t *ppos)
+static ssize_t sc1200wdt_write(struct kiocb *iocb, struct iov_iter *from)
{
+ size_t len = iov_iter_count(from);
if (len) {
if (!nowayout) {
size_t i;
@@ -273,7 +273,7 @@ static ssize_t sc1200wdt_write(struct file *file, const char __user *data,
for (i = 0; i != len; i++) {
char c;

- if (get_user(c, data + i))
+ if (get_iter(c, from))
return -EFAULT;
if (c == 'V')
expect_close = 42;
@@ -287,7 +287,6 @@ static ssize_t sc1200wdt_write(struct file *file, const char __user *data,
return 0;
}

-
static int sc1200wdt_notify_sys(struct notifier_block *this,
unsigned long code, void *unused)
{
@@ -305,7 +304,7 @@ static struct notifier_block sc1200wdt_notifier = {
static const struct file_operations sc1200wdt_fops = {
.owner = THIS_MODULE,
.llseek = no_llseek,
- .write = sc1200wdt_write,
+ .write_iter = sc1200wdt_write,
.unlocked_ioctl = sc1200wdt_ioctl,
.compat_ioctl = compat_ptr_ioctl,
.open = sc1200wdt_open,
--
2.43.0