[PATCH 277/437] watchdog: sbc8360: convert to read/write iterators

Jens Axboe
2024-04-11T15:39:21Z

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

diff --git a/drivers/watchdog/sbc8360.c b/drivers/watchdog/sbc8360.c
index 4f8b9912fc51..5d7042c85988 100644
--- a/drivers/watchdog/sbc8360.c
+++ b/drivers/watchdog/sbc8360.c
@@ -234,9 +234,10 @@ static void sbc8360_stop(void)
}

/* Userspace pings kernel driver, or requests clean close */
-static ssize_t sbc8360_write(struct file *file, const char __user *buf,
- size_t count, loff_t *ppos)
+static ssize_t sbc8360_write(struct kiocb *iocb, struct iov_iter *from)
{
+ size_t count = iov_iter_count(from);
+
if (count) {
if (!nowayout) {
size_t i;
@@ -246,7 +247,7 @@ static ssize_t sbc8360_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')
expect_close = 42;
@@ -302,7 +303,7 @@ static int sbc8360_notify_sys(struct notifier_block *this, unsigned long code,
static const struct file_operations sbc8360_fops = {
.owner = THIS_MODULE,
.llseek = no_llseek,
- .write = sbc8360_write,
+ .write_iter = sbc8360_write,
.open = sbc8360_open,
.release = sbc8360_close,
};
--
2.43.0