[PATCH 028/437] char/nwflash: convert to read/write iterators

Jens Axboe
2024-04-11T15:32:17Z

drivers/char/nwflash.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/char/nwflash.c b/drivers/char/nwflash.c
index 0973c2c2b01a..0b66135c7cd4 100644
--- a/drivers/char/nwflash.c
+++ b/drivers/char/nwflash.c
@@ -120,8 +120,7 @@ static long flash_ioctl(struct file *filep, unsigned int cmd, unsigned long arg)
return 0;
}

-static ssize_t flash_read(struct file *file, char __user *buf, size_t size,
- loff_t *ppos)
+static ssize_t flash_read(struct kiocb *iocb, struct iov_iter *to)
{
ssize_t ret;

@@ -134,7 +133,8 @@ static ssize_t flash_read(struct file *file, char __user *buf, size_t size,
if (mutex_lock_interruptible(&nwflash_mutex))
return -ERESTARTSYS;

- ret = simple_read_from_buffer(buf, size, ppos, (void *)FLASH_BASE, gbFlashSize);
+ ret = simple_copy_to_iter((void *)FLASH_BASE, &iocb->ki_pos,
+ gbFlashSize, to);
mutex_unlock(&nwflash_mutex);

return ret;
@@ -259,7 +259,7 @@ static ssize_t flash_write(struct file *file, const char __user *buf,

return written;
}
-
+FOPS_WRITE_ITER_HELPER(flash_write);

/*
* The memory devices use the full 32/64 bits of the offset, and so we cannot
@@ -569,8 +569,8 @@ static const struct file_operations flash_fops =
{
.owner = THIS_MODULE,
.llseek = flash_llseek,
- .read = flash_read,
- .write = flash_write,
+ .read_iter = flash_read,
+ .write_iter = flash_write_iter,
.unlocked_ioctl = flash_ioctl,
};

--
2.43.0