[PATCH 234/437] watchdog: advantechwdt: convert to read/write iterators

From: Jens Axboe
Date: Thu Apr 11 2024 - 12:33:30 EST


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

diff --git a/drivers/watchdog/advantechwdt.c b/drivers/watchdog/advantechwdt.c
index 7a0acbc3e4dd..95c1b90abedc 100644
--- a/drivers/watchdog/advantechwdt.c
+++ b/drivers/watchdog/advantechwdt.c
@@ -106,9 +106,9 @@ static int advwdt_set_heartbeat(int t)
* /dev/watchdog handling
*/

-static ssize_t advwdt_write(struct file *file, const char __user *buf,
- size_t count, loff_t *ppos)
+static ssize_t advwdt_write(struct kiocb *iocb, struct iov_iter *from)
{
+ size_t count = iov_iter_count(from);
if (count) {
if (!nowayout) {
size_t i;
@@ -117,7 +117,7 @@ static ssize_t advwdt_write(struct file *file, const char __user *buf,

for (i = 0; i != count; i++) {
char c;
- if (get_user(c, buf + i))
+ if (get_iter(c, from))
return -EFAULT;
if (c == 'V')
adv_expect_close = 42;
@@ -218,7 +218,7 @@ static int advwdt_close(struct inode *inode, struct file *file)
static const struct file_operations advwdt_fops = {
.owner = THIS_MODULE,
.llseek = no_llseek,
- .write = advwdt_write,
+ .write_iter = advwdt_write,
.unlocked_ioctl = advwdt_ioctl,
.compat_ioctl = compat_ptr_ioctl,
.open = advwdt_open,
--
2.43.0