[PATCH 171/437] usb: musb: convert to read/write iterators

From: Jens Axboe
Date: Thu Apr 11 2024 - 12:36:10 EST


Signed-off-by: Jens Axboe <axboe@xxxxxxxxx>
---
drivers/usb/musb/musb_debugfs.c | 24 ++++++++++++------------
1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/usb/musb/musb_debugfs.c b/drivers/usb/musb/musb_debugfs.c
index 2d623284edf6..7123057d12f7 100644
--- a/drivers/usb/musb/musb_debugfs.c
+++ b/drivers/usb/musb/musb_debugfs.c
@@ -160,17 +160,17 @@ static int musb_test_mode_open(struct inode *inode, struct file *file)
return single_open(file, musb_test_mode_show, inode->i_private);
}

-static ssize_t musb_test_mode_write(struct file *file,
- const char __user *ubuf, size_t count, loff_t *ppos)
+static ssize_t musb_test_mode_write(struct kiocb *iocb, struct iov_iter *from)
{
- struct seq_file *s = file->private_data;
+ struct seq_file *s = iocb->ki_filp->private_data;
+ size_t count = iov_iter_count(from);
struct musb *musb = s->private;
u8 test;
char buf[24];

memset(buf, 0x00, sizeof(buf));

- if (copy_from_user(buf, ubuf, min_t(size_t, sizeof(buf) - 1, count)))
+ if (!copy_from_iter_full(buf, min_t(size_t, sizeof(buf) - 1, count), from))
return -EFAULT;

pm_runtime_get_sync(musb->controller);
@@ -223,8 +223,8 @@ static ssize_t musb_test_mode_write(struct file *file,

static const struct file_operations musb_test_mode_fops = {
.open = musb_test_mode_open,
- .write = musb_test_mode_write,
- .read = seq_read,
+ .write_iter = musb_test_mode_write,
+ .read_iter = seq_read_iter,
.llseek = seq_lseek,
.release = single_release,
};
@@ -260,17 +260,17 @@ static int musb_softconnect_open(struct inode *inode, struct file *file)
return single_open(file, musb_softconnect_show, inode->i_private);
}

-static ssize_t musb_softconnect_write(struct file *file,
- const char __user *ubuf, size_t count, loff_t *ppos)
+static ssize_t musb_softconnect_write(struct kiocb *iocb, struct iov_iter *from)
{
- struct seq_file *s = file->private_data;
+ struct seq_file *s = iocb->ki_filp->private_data;
+ size_t count = iov_iter_count(from);
struct musb *musb = s->private;
char buf[2];
u8 reg;

memset(buf, 0x00, sizeof(buf));

- if (copy_from_user(&buf, ubuf, min_t(size_t, sizeof(buf) - 1, count)))
+ if (!copy_from_iter_full(&buf, min_t(size_t, sizeof(buf) - 1, count), from))
return -EFAULT;

pm_runtime_get_sync(musb->controller);
@@ -315,8 +315,8 @@ static ssize_t musb_softconnect_write(struct file *file,
*/
static const struct file_operations musb_softconnect_fops = {
.open = musb_softconnect_open,
- .write = musb_softconnect_write,
- .read = seq_read,
+ .write_iter = musb_softconnect_write,
+ .read_iter = seq_read_iter,
.llseek = seq_lseek,
.release = single_release,
};
--
2.43.0