lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240411153126.16201-369-axboe@kernel.dk>
Date: Thu, 11 Apr 2024 09:18:28 -0600
From: Jens Axboe <axboe@...nel.dk>
To: linux-kernel@...r.kernel.org
Cc: Jens Axboe <axboe@...nel.dk>
Subject: [PATCH 368/437] hwmon: pt5161l: convert to read/write iterators

Signed-off-by: Jens Axboe <axboe@...nel.dk>
---
 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


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ