lkml.org 
[lkml]   [2024]   [Apr]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 255/437] watchdog: sc1200wdt: convert to read/write iterators
Date
Signed-off-by: Jens Axboe <axboe@kernel.dk>
---
drivers/watchdog/sc1200wdt.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/watchdog/sc1200wdt.c b/drivers/watchdog/sc1200wdt.c
index f22ebe89fe13..d8d8bee1d6d4 100644
--- a/drivers/watchdog/sc1200wdt.c
+++ b/drivers/watchdog/sc1200wdt.c
@@ -261,9 +261,9 @@ static int sc1200wdt_release(struct inode *inode, struct file *file)
}


-static ssize_t sc1200wdt_write(struct file *file, const char __user *data,
- size_t len, loff_t *ppos)
+static ssize_t sc1200wdt_write(struct kiocb *iocb, struct iov_iter *from)
{
+ size_t len = iov_iter_count(from);
if (len) {
if (!nowayout) {
size_t i;
@@ -273,7 +273,7 @@ static ssize_t sc1200wdt_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')
expect_close = 42;
@@ -287,7 +287,6 @@ static ssize_t sc1200wdt_write(struct file *file, const char __user *data,
return 0;
}

-
static int sc1200wdt_notify_sys(struct notifier_block *this,
unsigned long code, void *unused)
{
@@ -305,7 +304,7 @@ static struct notifier_block sc1200wdt_notifier = {
static const struct file_operations sc1200wdt_fops = {
.owner = THIS_MODULE,
.llseek = no_llseek,
- .write = sc1200wdt_write,
+ .write_iter = sc1200wdt_write,
.unlocked_ioctl = sc1200wdt_ioctl,
.compat_ioctl = compat_ptr_ioctl,
.open = sc1200wdt_open,
--
2.43.0

\
 
 \ /
  Last update: 2024-05-27 16:36    [W:1.202 / U:0.404 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site