[PATCH 258/437] watchdog: smsc37b787_wdt: convert to read/write iterators

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


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

diff --git a/drivers/watchdog/smsc37b787_wdt.c b/drivers/watchdog/smsc37b787_wdt.c
index 7463df479d11..e1a0c1b4ca90 100644
--- a/drivers/watchdog/smsc37b787_wdt.c
+++ b/drivers/watchdog/smsc37b787_wdt.c
@@ -386,9 +386,9 @@ static int wb_smsc_wdt_release(struct inode *inode, struct file *file)

/* write => update the timer to keep the machine alive */

-static ssize_t wb_smsc_wdt_write(struct file *file, const char __user *data,
- size_t len, loff_t *ppos)
+static ssize_t wb_smsc_wdt_write(struct kiocb *iocb, struct iov_iter *from)
{
+ size_t len = iov_iter_count(from);
/* See if we got the magic character 'V' and reload the timer */
if (len) {
if (!nowayout) {
@@ -401,7 +401,7 @@ static ssize_t wb_smsc_wdt_write(struct file *file, const char __user *data,
magic character */
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;
@@ -503,7 +503,7 @@ static int wb_smsc_wdt_notify_sys(struct notifier_block *this,
static const struct file_operations wb_smsc_wdt_fops = {
.owner = THIS_MODULE,
.llseek = no_llseek,
- .write = wb_smsc_wdt_write,
+ .write_iter = wb_smsc_wdt_write,
.unlocked_ioctl = wb_smsc_wdt_ioctl,
.compat_ioctl = compat_ptr_ioctl,
.open = wb_smsc_wdt_open,
--
2.43.0