[PATCH 368/437] hwmon: pt5161l: convert to read/write iterators
From: Jens Axboe
Date: Thu Apr 11 2024 - 13:04:47 EST
Signed-off-by: Jens Axboe <axboe@xxxxxxxxx>
---
drivers/hwmon/pt5161l.c | 31 +++++++++++++++----------------
1 file changed, 15 insertions(+), 16 deletions(-)
diff --git a/drivers/hwmon/pt5161l.c b/drivers/hwmon/pt5161l.c
index 60361e39c474..90cb27822ac0 100644
--- a/drivers/hwmon/pt5161l.c
+++ b/drivers/hwmon/pt5161l.c
@@ -493,10 +493,10 @@ static const struct hwmon_chip_info pt5161l_chip_info = {
.info = pt5161l_info,
};
-static ssize_t pt5161l_debugfs_read_fw_ver(struct file *file, char __user *buf,
- size_t count, loff_t *ppos)
+static ssize_t pt5161l_debugfs_read_fw_ver(struct kiocb *iocb,
+ struct iov_iter *to)
{
- struct pt5161l_data *data = file->private_data;
+ struct pt5161l_data *data = iocb->ki_filp->private_data;
int ret;
char ver[32];
@@ -509,19 +509,18 @@ static ssize_t pt5161l_debugfs_read_fw_ver(struct file *file, char __user *buf,
ret = snprintf(ver, sizeof(ver), "%u.%u.%u\n", data->fw_ver.major,
data->fw_ver.minor, data->fw_ver.build);
- return simple_read_from_buffer(buf, count, ppos, ver, ret);
+ return simple_copy_to_iter(ver, &iocb->ki_pos, ret, to);
}
static const struct file_operations pt5161l_debugfs_ops_fw_ver = {
- .read = pt5161l_debugfs_read_fw_ver,
+ .read_iter = pt5161l_debugfs_read_fw_ver,
.open = simple_open,
};
-static ssize_t pt5161l_debugfs_read_fw_load_sts(struct file *file,
- char __user *buf, size_t count,
- loff_t *ppos)
+static ssize_t pt5161l_debugfs_read_fw_load_sts(struct kiocb *iocb,
+ struct iov_iter *to)
{
- struct pt5161l_data *data = file->private_data;
+ struct pt5161l_data *data = iocb->ki_filp->private_data;
int ret;
bool status = false;
char health[16];
@@ -535,18 +534,18 @@ static ssize_t pt5161l_debugfs_read_fw_load_sts(struct file *file,
ret = snprintf(health, sizeof(health), "%s\n",
status ? "normal" : "abnormal");
- return simple_read_from_buffer(buf, count, ppos, health, ret);
+ return simple_copy_to_iter(health, &iocb->ki_pos, ret, to);
}
static const struct file_operations pt5161l_debugfs_ops_fw_load_sts = {
- .read = pt5161l_debugfs_read_fw_load_sts,
+ .read_iter = pt5161l_debugfs_read_fw_load_sts,
.open = simple_open,
};
-static ssize_t pt5161l_debugfs_read_hb_sts(struct file *file, char __user *buf,
- size_t count, loff_t *ppos)
+static ssize_t pt5161l_debugfs_read_hb_sts(struct kiocb *iocb,
+ struct iov_iter *to)
{
- struct pt5161l_data *data = file->private_data;
+ struct pt5161l_data *data = iocb->ki_filp->private_data;
int ret;
bool status = false;
char health[16];
@@ -560,11 +559,11 @@ static ssize_t pt5161l_debugfs_read_hb_sts(struct file *file, char __user *buf,
ret = snprintf(health, sizeof(health), "%s\n",
status ? "normal" : "abnormal");
- return simple_read_from_buffer(buf, count, ppos, health, ret);
+ return simple_copy_to_iter(health, &iocb->ki_pos, ret, to);
}
static const struct file_operations pt5161l_debugfs_ops_hb_sts = {
- .read = pt5161l_debugfs_read_hb_sts,
+ .read_iter = pt5161l_debugfs_read_hb_sts,
.open = simple_open,
};
--
2.43.0