[PATCH 262/437] watchdog: watchdog_dev: convert to read/write iterators

From: Jens Axboe
Date: Thu Apr 11 2024 - 12:42:39 EST


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

diff --git a/drivers/watchdog/watchdog_dev.c b/drivers/watchdog/watchdog_dev.c
index e2bd266b1b5b..828141d16264 100644
--- a/drivers/watchdog/watchdog_dev.c
+++ b/drivers/watchdog/watchdog_dev.c
@@ -694,10 +694,10 @@ static int watchdog_ioctl_op(struct watchdog_device *wdd, unsigned int cmd,
*
* Return: @len if successful, error otherwise.
*/
-static ssize_t watchdog_write(struct file *file, const char __user *data,
- size_t len, loff_t *ppos)
+static ssize_t watchdog_write(struct kiocb *iocb, struct iov_iter *from)
{
- struct watchdog_core_data *wd_data = file->private_data;
+ struct watchdog_core_data *wd_data = iocb->ki_filp->private_data;
+ size_t len = iov_iter_count(from);
struct watchdog_device *wdd;
int err;
size_t i;
@@ -714,7 +714,7 @@ static ssize_t watchdog_write(struct file *file, const char __user *data,

/* scan to see whether or not we got the magic character */
for (i = 0; i != len; i++) {
- if (get_user(c, data + i))
+ if (get_iter(c, from))
return -EFAULT;
if (c == 'V')
set_bit(_WDOG_ALLOW_RELEASE, &wd_data->status);
@@ -991,7 +991,7 @@ static int watchdog_release(struct inode *inode, struct file *file)

static const struct file_operations watchdog_fops = {
.owner = THIS_MODULE,
- .write = watchdog_write,
+ .write_iter = watchdog_write,
.unlocked_ioctl = watchdog_ioctl,
.compat_ioctl = compat_ptr_ioctl,
.open = watchdog_open,
--
2.43.0