[PATCH 011/437] virtio_console: convert to read/write iterator helpers

Jens Axboe
2024-04-11T15:31:48Z

Add stub read/write iterators which just use the VFS helpers, and
kill the ->read() and ->write() usage.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
---
drivers/char/virtio_console.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c
index 035f89f1a251..154934eb9ae9 100644
--- a/drivers/char/virtio_console.c
+++ b/drivers/char/virtio_console.c
@@ -771,6 +771,7 @@ static ssize_t port_fops_read(struct file *filp, char __user *ubuf,

return fill_readbuf(port, ubuf, count, true);
}
+FOPS_READ_ITER_HELPER(port_fops_read);

static int wait_port_writable(struct port *port, bool nonblock)
{
@@ -844,6 +845,7 @@ static ssize_t port_fops_write(struct file *filp, const char __user *ubuf,
out:
return ret;
}
+FOPS_WRITE_ITER_HELPER(port_fops_write);

struct sg_list {
unsigned int n;
@@ -1087,8 +1089,8 @@ static int port_fops_fasync(int fd, struct file *filp, int mode)
static const struct file_operations port_fops = {
.owner = THIS_MODULE,
.open = port_fops_open,
- .read = port_fops_read,
- .write = port_fops_write,
+ .read_iter = port_fops_read_iter,
+ .write_iter = port_fops_write_iter,
.splice_write = port_fops_splice_write,
.poll = port_fops_poll,
.release = port_fops_release,
--
2.43.0