[PATCH 272/437] watchdog: pika_wdt: convert to read/write iterators

Jens Axboe
2024-04-11T15:39:13Z

drivers/watchdog/pika_wdt.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/watchdog/pika_wdt.c b/drivers/watchdog/pika_wdt.c
index 782b8c23d99c..bf1ac356df69 100644
--- a/drivers/watchdog/pika_wdt.c
+++ b/drivers/watchdog/pika_wdt.c
@@ -139,9 +139,10 @@ static int pikawdt_release(struct inode *inode, struct file *file)
/*
* Pat the watchdog whenever device is written to.
*/
-static ssize_t pikawdt_write(struct file *file, const char __user *data,
- size_t len, loff_t *ppos)
+static ssize_t pikawdt_write(struct kiocb *iocb, struct iov_iter *from)
{
+ size_t len = iov_iter_count(from);
+
if (!len)
return 0;

@@ -153,7 +154,7 @@ static ssize_t pikawdt_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') {
pikawdt_private.expect_close = 42;
@@ -212,7 +213,7 @@ static const struct file_operations pikawdt_fops = {
.llseek = no_llseek,
.open = pikawdt_open,
.release = pikawdt_release,
- .write = pikawdt_write,
+ .write_iter = pikawdt_write,
.unlocked_ioctl = pikawdt_ioctl,
.compat_ioctl = compat_ptr_ioctl,
};
--
2.43.0