[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240411153126.16201-154-axboe@kernel.dk>
Date: Thu, 11 Apr 2024 09:14:53 -0600
From: Jens Axboe <axboe@...nel.dk>
To: linux-kernel@...r.kernel.org
Cc: Jens Axboe <axboe@...nel.dk>
Subject: [PATCH 153/437] drivers/dma: convert to read/write iterators
Signed-off-by: Jens Axboe <axboe@...nel.dk>
---
drivers/dma/xilinx/xilinx_dpdma.c | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/drivers/dma/xilinx/xilinx_dpdma.c b/drivers/dma/xilinx/xilinx_dpdma.c
index b82815e64d24..8a443cd0cd44 100644
--- a/drivers/dma/xilinx/xilinx_dpdma.c
+++ b/drivers/dma/xilinx/xilinx_dpdma.c
@@ -354,14 +354,14 @@ static struct xilinx_dpdma_debugfs_request dpdma_debugfs_reqs[] = {
},
};
-static ssize_t xilinx_dpdma_debugfs_read(struct file *f, char __user *buf,
- size_t size, loff_t *pos)
+static ssize_t xilinx_dpdma_debugfs_read(struct kiocb *iocb, struct iov_iter *to)
{
enum xilinx_dpdma_testcases testcase;
+ size_t size = iov_iter_count(to);
char *kern_buff;
int ret = 0;
- if (*pos != 0 || size <= 0)
+ if (iocb->ki_pos != 0 || size <= 0)
return -EINVAL;
kern_buff = kzalloc(XILINX_DPDMA_DEBUGFS_READ_MAX_SIZE, GFP_KERNEL);
@@ -381,7 +381,7 @@ static ssize_t xilinx_dpdma_debugfs_read(struct file *f, char __user *buf,
}
size = min(size, strlen(kern_buff));
- if (copy_to_user(buf, kern_buff, size))
+ if (!copy_to_iter_full(kern_buff, size, to))
ret = -EFAULT;
done:
@@ -389,7 +389,7 @@ static ssize_t xilinx_dpdma_debugfs_read(struct file *f, char __user *buf,
if (ret)
return ret;
- *pos = size + 1;
+ iocb->ki_pos = size + 1;
return size;
}
@@ -441,11 +441,12 @@ static ssize_t xilinx_dpdma_debugfs_write(struct file *f,
kfree(kern_buff_start);
return ret;
}
+FOPS_WRITE_ITER_HELPER(xilinx_dpdma_debugfs_write);
static const struct file_operations fops_xilinx_dpdma_dbgfs = {
.owner = THIS_MODULE,
- .read = xilinx_dpdma_debugfs_read,
- .write = xilinx_dpdma_debugfs_write,
+ .read_iter = xilinx_dpdma_debugfs_read,
+ .write_iter = xilinx_dpdma_debugfs_write_iter,
};
static void xilinx_dpdma_debugfs_init(struct xilinx_dpdma_device *xdev)
--
2.43.0
Powered by blists - more mailing lists