[PATCH 163/437] usb: host: ehci: convert to read/write iterators

From: Jens Axboe
Date: Thu Apr 11 2024 - 12:16:28 EST


Signed-off-by: Jens Axboe <axboe@xxxxxxxxx>
---
drivers/usb/host/ehci-dbg.c | 19 ++++++++-----------
1 file changed, 8 insertions(+), 11 deletions(-)

diff --git a/drivers/usb/host/ehci-dbg.c b/drivers/usb/host/ehci-dbg.c
index c063fb042926..c9390a17c432 100644
--- a/drivers/usb/host/ehci-dbg.c
+++ b/drivers/usb/host/ehci-dbg.c
@@ -293,13 +293,13 @@ static int debug_bandwidth_open(struct inode *, struct file *);
static int debug_periodic_open(struct inode *, struct file *);
static int debug_registers_open(struct inode *, struct file *);

-static ssize_t debug_output(struct file*, char __user*, size_t, loff_t*);
+static ssize_t debug_output(struct kiocb *, struct iov_iter *);
static int debug_close(struct inode *, struct file *);

static const struct file_operations debug_async_fops = {
.owner = THIS_MODULE,
.open = debug_async_open,
- .read = debug_output,
+ .read_iter = debug_output,
.release = debug_close,
.llseek = default_llseek,
};
@@ -307,7 +307,7 @@ static const struct file_operations debug_async_fops = {
static const struct file_operations debug_bandwidth_fops = {
.owner = THIS_MODULE,
.open = debug_bandwidth_open,
- .read = debug_output,
+ .read_iter = debug_output,
.release = debug_close,
.llseek = default_llseek,
};
@@ -315,7 +315,7 @@ static const struct file_operations debug_bandwidth_fops = {
static const struct file_operations debug_periodic_fops = {
.owner = THIS_MODULE,
.open = debug_periodic_open,
- .read = debug_output,
+ .read_iter = debug_output,
.release = debug_close,
.llseek = default_llseek,
};
@@ -323,7 +323,7 @@ static const struct file_operations debug_periodic_fops = {
static const struct file_operations debug_registers_fops = {
.owner = THIS_MODULE,
.open = debug_registers_open,
- .read = debug_output,
+ .read_iter = debug_output,
.release = debug_close,
.llseek = default_llseek,
};
@@ -952,10 +952,9 @@ static int fill_buffer(struct debug_buffer *buf)
return ret;
}

-static ssize_t debug_output(struct file *file, char __user *user_buf,
- size_t len, loff_t *offset)
+static ssize_t debug_output(struct kiocb *iocb, struct iov_iter *to)
{
- struct debug_buffer *buf = file->private_data;
+ struct debug_buffer *buf = iocb->ki_filp->private_data;
int ret;

mutex_lock(&buf->mutex);
@@ -968,9 +967,7 @@ static ssize_t debug_output(struct file *file, char __user *user_buf,
}
mutex_unlock(&buf->mutex);

- ret = simple_read_from_buffer(user_buf, len, offset,
- buf->output_buf, buf->count);
-
+ ret = simple_copy_to_iter(buf->output_buf, &iocb->ki_pos, buf->count, to);
out:
return ret;
}
--
2.43.0