[PATCH 254/437] watchdog: sbc_fitpc2_wdt: convert to read/write iterators

Jens Axboe
2024-04-11T15:38:43Z

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

diff --git a/drivers/watchdog/sbc_fitpc2_wdt.c b/drivers/watchdog/sbc_fitpc2_wdt.c
index b8eb8d5ca1af..1619f92814cf 100644
--- a/drivers/watchdog/sbc_fitpc2_wdt.c
+++ b/drivers/watchdog/sbc_fitpc2_wdt.c
@@ -76,9 +76,9 @@ static int fitpc2_wdt_open(struct inode *inode, struct file *file)
return stream_open(inode, file);
}

-static ssize_t fitpc2_wdt_write(struct file *file, const char __user *data,
- size_t len, loff_t *ppos)
+static ssize_t fitpc2_wdt_write(struct kiocb *iocb, struct iov_iter *from)
{
+ size_t len = iov_iter_count(from);
size_t i;

if (!len)
@@ -94,7 +94,7 @@ static ssize_t fitpc2_wdt_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')
@@ -107,7 +107,6 @@ static ssize_t fitpc2_wdt_write(struct file *file, const char __user *data,
return len;
}

-
static const struct watchdog_info ident = {
.options = WDIOF_MAGICCLOSE | WDIOF_SETTIMEOUT |
WDIOF_KEEPALIVEPING,
@@ -182,7 +181,7 @@ static int fitpc2_wdt_release(struct inode *inode, struct file *file)
static const struct file_operations fitpc2_wdt_fops = {
.owner = THIS_MODULE,
.llseek = no_llseek,
- .write = fitpc2_wdt_write,
+ .write_iter = fitpc2_wdt_write,
.unlocked_ioctl = fitpc2_wdt_ioctl,
.compat_ioctl = compat_ptr_ioctl,
.open = fitpc2_wdt_open,
--
2.43.0