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-16-axboe@kernel.dk>
Date: Thu, 11 Apr 2024 09:12:35 -0600
From: Jens Axboe <axboe@...nel.dk>
To: linux-kernel@...r.kernel.org
Cc: Jens Axboe <axboe@...nel.dk>
Subject: [PATCH 015/437] char/nsc_gpio: convert to read/write iterators

Signed-off-by: Jens Axboe <axboe@...nel.dk>
---
 drivers/char/nsc_gpio.c  | 22 ++++++++++++++++------
 include/linux/nsc_gpio.h |  8 ++------
 2 files changed, 18 insertions(+), 12 deletions(-)

diff --git a/drivers/char/nsc_gpio.c b/drivers/char/nsc_gpio.c
index da930c72bc74..0df6fb1232cd 100644
--- a/drivers/char/nsc_gpio.c
+++ b/drivers/char/nsc_gpio.c
@@ -39,8 +39,8 @@ void nsc_gpio_dump(struct nsc_gpio_ops *amp, unsigned index)
 		 amp->gpio_get(index), amp->gpio_current(index));
 }
 
-ssize_t nsc_gpio_write(struct file *file, const char __user *data,
-		       size_t len, loff_t *ppos)
+static ssize_t nsc_gpio_write(struct file *file, const char __user *data,
+			      size_t len, loff_t *ppos)
 {
 	unsigned m = iminor(file_inode(file));
 	struct nsc_gpio_ops *amp = file->private_data;
@@ -102,8 +102,8 @@ ssize_t nsc_gpio_write(struct file *file, const char __user *data,
 	return len;
 }
 
-ssize_t nsc_gpio_read(struct file *file, char __user * buf,
-		      size_t len, loff_t * ppos)
+static ssize_t nsc_gpio_read(struct file *file, char __user * buf, size_t len,
+			     loff_t * ppos)
 {
 	unsigned m = iminor(file_inode(file));
 	int value;
@@ -116,9 +116,19 @@ ssize_t nsc_gpio_read(struct file *file, char __user * buf,
 	return 1;
 }
 
+ssize_t nsc_gpio_read_iter(struct kiocb *iocb, struct iov_iter *to)
+{
+	return vfs_read_iter(iocb, to, nsc_gpio_read);
+}
+EXPORT_SYMBOL(nsc_gpio_read_iter);
+
+ssize_t nsc_gpio_write_iter(struct kiocb *iocb, struct iov_iter *from)
+{
+	return vfs_write_iter(iocb, from, nsc_gpio_write);
+}
+EXPORT_SYMBOL(nsc_gpio_write_iter);
+
 /* common file-ops routines for both scx200_gpio and pc87360_gpio */
-EXPORT_SYMBOL(nsc_gpio_write);
-EXPORT_SYMBOL(nsc_gpio_read);
 EXPORT_SYMBOL(nsc_gpio_dump);
 
 static int __init nsc_gpio_init(void)
diff --git a/include/linux/nsc_gpio.h b/include/linux/nsc_gpio.h
index d7a04a6e3783..a97111b2e85d 100644
--- a/include/linux/nsc_gpio.h
+++ b/include/linux/nsc_gpio.h
@@ -31,11 +31,7 @@ struct nsc_gpio_ops {
 	struct device*	dev;	/* for dev_dbg() support, set in init  */
 };
 
-extern ssize_t nsc_gpio_write(struct file *file, const char __user *data,
-			      size_t len, loff_t *ppos);
-
-extern ssize_t nsc_gpio_read(struct file *file, char __user *buf,
-			     size_t len, loff_t *ppos);
-
+ssize_t nsc_gpio_write_iter(struct kiocb *iocb, struct iov_iter *from);
+ssize_t nsc_gpio_read_iter(struct kiocb *iocb, struct iov_iter *to);
 extern void nsc_gpio_dump(struct nsc_gpio_ops *amp, unsigned index);
 
-- 
2.43.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ