[PATCH 359/437] hwmon: w83793: convert to read/write iterators

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


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

diff --git a/drivers/hwmon/w83793.c b/drivers/hwmon/w83793.c
index 96bab94ba899..7594fc588112 100644
--- a/drivers/hwmon/w83793.c
+++ b/drivers/hwmon/w83793.c
@@ -1352,11 +1352,11 @@ static int watchdog_close(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)
{
ssize_t ret;
- struct w83793_data *data = filp->private_data;
+ struct w83793_data *data = iocb->ki_filp->private_data;
+ size_t count = iov_iter_count(from);

if (count) {
if (!nowayout) {
@@ -1367,7 +1367,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;
@@ -1454,7 +1454,7 @@ static const struct file_operations watchdog_fops = {
.llseek = no_llseek,
.open = watchdog_open,
.release = watchdog_close,
- .write = watchdog_write,
+ .write_iter = watchdog_write,
.unlocked_ioctl = watchdog_ioctl,
.compat_ioctl = compat_ptr_ioctl,
};
--
2.43.0