[PATCH 358/437] hwmon: fschmd: convert to read/write iterators

From: Jens Axboe
Date: Thu Apr 11 2024 - 13:02:11 EST


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

diff --git a/drivers/hwmon/fschmd.c b/drivers/hwmon/fschmd.c
index b30512a705a7..896a073811a0 100644
--- a/drivers/hwmon/fschmd.c
+++ b/drivers/hwmon/fschmd.c
@@ -848,11 +848,11 @@ static int watchdog_release(struct inode *inode, struct file *filp)
return 0;
}

-static ssize_t watchdog_write(struct file *filp, const char __user *buf,
- size_t count, loff_t *offset)
+static ssize_t watchdog_write(struct kiocb *iocb, struct iov_iter *from)
{
int ret;
- struct fschmd_data *data = filp->private_data;
+ struct fschmd_data *data = iocb->ki_filp->private_data;
+ size_t count = iov_iter_count(from);

if (count) {
if (!nowayout) {
@@ -863,7 +863,7 @@ static ssize_t watchdog_write(struct file *filp, 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')
data->watchdog_expect_close = 1;
@@ -951,7 +951,7 @@ static const struct file_operations watchdog_fops = {
.llseek = no_llseek,
.open = watchdog_open,
.release = watchdog_release,
- .write = watchdog_write,
+ .write_iter = watchdog_write,
.unlocked_ioctl = watchdog_ioctl,
.compat_ioctl = compat_ptr_ioctl,
};
--
2.43.0