[PATCH 380/437] iio: adis16480: convert to read/write iterators

Jens Axboe
2024-04-11T15:42:20Z

drivers/iio/imu/adis16480.c | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/iio/imu/adis16480.c b/drivers/iio/imu/adis16480.c
index b40a55bba30c..2664a187872f 100644
--- a/drivers/iio/imu/adis16480.c
+++ b/drivers/iio/imu/adis16480.c
@@ -188,10 +188,10 @@ MODULE_PARM_DESC(low_rate_allow,

#ifdef CONFIG_DEBUG_FS

-static ssize_t adis16480_show_firmware_revision(struct file *file,
- char __user *userbuf, size_t count, loff_t *ppos)
+static ssize_t adis16480_show_firmware_revision(struct kiocb *iocb,
+ struct iov_iter *to)
{
- struct adis16480 *adis16480 = file->private_data;
+ struct adis16480 *adis16480 = iocb->ki_filp->private_data;
char buf[7];
size_t len;
u16 rev;
@@ -203,20 +203,20 @@ static ssize_t adis16480_show_firmware_revision(struct file *file,

len = scnprintf(buf, sizeof(buf), "%x.%x\n", rev >> 8, rev & 0xff);

- return simple_read_from_buffer(userbuf, count, ppos, buf, len);
+ return simple_copy_to_iter(buf, &iocb->ki_pos, len, to);
}

static const struct file_operations adis16480_firmware_revision_fops = {
.open = simple_open,
- .read = adis16480_show_firmware_revision,
+ .read_iter = adis16480_show_firmware_revision,
.llseek = default_llseek,
.owner = THIS_MODULE,
};

-static ssize_t adis16480_show_firmware_date(struct file *file,
- char __user *userbuf, size_t count, loff_t *ppos)
+static ssize_t adis16480_show_firmware_date(struct kiocb *iocb,
+ struct iov_iter *to)
{
- struct adis16480 *adis16480 = file->private_data;
+ struct adis16480 *adis16480 = iocb->ki_filp->private_data;
u16 md, year;
char buf[12];
size_t len;
@@ -233,12 +233,12 @@ static ssize_t adis16480_show_firmware_date(struct file *file,
len = snprintf(buf, sizeof(buf), "%.2x-%.2x-%.4x\n",
md >> 8, md & 0xff, year);

- return simple_read_from_buffer(userbuf, count, ppos, buf, len);
+ return simple_copy_to_iter(buf, &iocb->ki_pos, len, to);
}

static const struct file_operations adis16480_firmware_date_fops = {
.open = simple_open,
- .read = adis16480_show_firmware_date,
+ .read_iter = adis16480_show_firmware_date,
.llseek = default_llseek,