[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240411153126.16201-249-axboe@kernel.dk>
Date: Thu, 11 Apr 2024 09:16:28 -0600
From: Jens Axboe <axboe@...nel.dk>
To: linux-kernel@...r.kernel.org
Cc: Jens Axboe <axboe@...nel.dk>
Subject: [PATCH 248/437] watchdog: pcwd_pci: convert to read/write iterators
Signed-off-by: Jens Axboe <axboe@...nel.dk>
---
drivers/watchdog/pcwd_pci.c | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)
diff --git a/drivers/watchdog/pcwd_pci.c b/drivers/watchdog/pcwd_pci.c
index 54d86fcb1837..6b7b3bd2ed83 100644
--- a/drivers/watchdog/pcwd_pci.c
+++ b/drivers/watchdog/pcwd_pci.c
@@ -431,9 +431,9 @@ static int pcipcwd_get_timeleft(int *time_left)
* /dev/watchdog handling
*/
-static ssize_t pcipcwd_write(struct file *file, const char __user *data,
- size_t len, loff_t *ppos)
+static ssize_t pcipcwd_write(struct kiocb *iocb, struct iov_iter *from)
{
+ size_t len = iov_iter_count(from);
/* See if we got the magic character 'V' and reload the timer */
if (len) {
if (!nowayout) {
@@ -447,7 +447,7 @@ static ssize_t pcipcwd_write(struct file *file, const char __user *data,
* magic character */
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_release = 42;
@@ -597,15 +597,14 @@ static int pcipcwd_release(struct inode *inode, struct file *file)
* /dev/temperature handling
*/
-static ssize_t pcipcwd_temp_read(struct file *file, char __user *data,
- size_t len, loff_t *ppos)
+static ssize_t pcipcwd_temp_read(struct kiocb *iocb, struct iov_iter *to)
{
int temperature;
if (pcipcwd_get_temperature(&temperature))
return -EFAULT;
- if (copy_to_user(data, &temperature, 1))
+ if (!copy_to_iter_full(&temperature, 1, to))
return -EFAULT;
return 1;
@@ -644,7 +643,7 @@ static int pcipcwd_notify_sys(struct notifier_block *this, unsigned long code,
static const struct file_operations pcipcwd_fops = {
.owner = THIS_MODULE,
.llseek = no_llseek,
- .write = pcipcwd_write,
+ .write_iter = pcipcwd_write,
.unlocked_ioctl = pcipcwd_ioctl,
.compat_ioctl = compat_ptr_ioctl,
.open = pcipcwd_open,
@@ -660,7 +659,7 @@ static struct miscdevice pcipcwd_miscdev = {
static const struct file_operations pcipcwd_temp_fops = {
.owner = THIS_MODULE,
.llseek = no_llseek,
- .read = pcipcwd_temp_read,
+ .read_iter = pcipcwd_temp_read,
.open = pcipcwd_temp_open,
.release = pcipcwd_temp_release,
};
--
2.43.0
Powered by blists - more mailing lists