[PATCH 027/437] char/nwbutton: convert to read/write iterators

Jens Axboe
2024-04-11T15:32:14Z

drivers/char/nwbutton.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/char/nwbutton.c b/drivers/char/nwbutton.c
index ea378c0ed549..3b60ee911c68 100644
--- a/drivers/char/nwbutton.c
+++ b/drivers/char/nwbutton.c
@@ -165,14 +165,13 @@ static irqreturn_t button_handler (int irq, void *dev_id)
* device at any one time.
*/

-static int button_read (struct file *filp, char __user *buffer,
- size_t count, loff_t *ppos)
+static int button_read (struct kiocb *iocb, struct iov_iter *to)
{
DEFINE_WAIT(wait);
prepare_to_wait(&button_wait_queue, &wait, TASK_INTERRUPTIBLE);
schedule();
finish_wait(&button_wait_queue, &wait);
- return (copy_to_user (buffer, &button_output_buffer, bcount))
+ return (!copy_to_iter_full(&button_output_buffer, bcount, to))
? -EFAULT : bcount;
}

@@ -184,7 +183,7 @@ static int button_read (struct file *filp, char __user *buffer,

static const struct file_operations button_fops = {
.owner = THIS_MODULE,
- .read = button_read,
+ .read_iter = button_read,
.llseek = noop_llseek,
};

--
2.43.0