[PATCH 161/437] usb: fotg210-hcd: convert to read/write iterators

Jens Axboe
2024-04-11T15:36:14Z

drivers/usb/fotg210/fotg210-hcd.c | 17 +++++++----------
1 file changed, 7 insertions(+), 10 deletions(-)

diff --git a/drivers/usb/fotg210/fotg210-hcd.c b/drivers/usb/fotg210/fotg210-hcd.c
index 8c5aaf860635..6a7334164ca7 100644
--- a/drivers/usb/fotg210/fotg210-hcd.c
+++ b/drivers/usb/fotg210/fotg210-hcd.c
@@ -283,27 +283,27 @@ static int debug_periodic_open(struct inode *, struct file *);
static int debug_registers_open(struct inode *, struct file *);
static int debug_async_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,
};
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,
};
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,
};
@@ -773,10 +773,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 = 0;

mutex_lock(&buf->mutex);
@@ -789,9 +788,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