[PATCH 426/437] firmware: xilinx: convert to read/write iterators
From: Jens Axboe
Date: Thu Apr 11 2024 - 13:17:54 EST
Signed-off-by: Jens Axboe <axboe@xxxxxxxxx>
---
drivers/firmware/xilinx/zynqmp-debug.c | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/drivers/firmware/xilinx/zynqmp-debug.c b/drivers/firmware/xilinx/zynqmp-debug.c
index 8528850af889..8d64bffd1890 100644
--- a/drivers/firmware/xilinx/zynqmp-debug.c
+++ b/drivers/firmware/xilinx/zynqmp-debug.c
@@ -143,9 +143,8 @@ static int process_api_request(u32 pm_id, u64 *pm_api_arg, u32 *pm_api_ret)
* Return: Number of bytes copied if PM-API request succeeds,
* the corresponding error code otherwise
*/
-static ssize_t zynqmp_pm_debugfs_api_write(struct file *file,
- const char __user *ptr, size_t len,
- loff_t *off)
+static ssize_t zynqmp_pm_debugfs_api_write(struct kiocb *iocb,
+ struct iov_iter *from)
{
char *kern_buff, *tmp_buff;
char *pm_api_req;
@@ -153,16 +152,17 @@ static ssize_t zynqmp_pm_debugfs_api_write(struct file *file,
u64 pm_api_arg[4] = {0, 0, 0, 0};
/* Return values from PM APIs calls */
u32 pm_api_ret[4] = {0, 0, 0, 0};
+ size_t len = iov_iter_count(from);
int ret;
int i = 0;
strcpy(debugfs_buf, "");
- if (*off != 0 || len <= 1 || len > PAGE_SIZE - 1)
+ if (iocb->ki_pos != 0 || len <= 1 || len > PAGE_SIZE - 1)
return -EINVAL;
- kern_buff = memdup_user_nul(ptr, len);
+ kern_buff = iterdup_user(from, len);
if (IS_ERR(kern_buff))
return PTR_ERR(kern_buff);
tmp_buff = kern_buff;
@@ -201,18 +201,18 @@ static ssize_t zynqmp_pm_debugfs_api_write(struct file *file,
* Return: Length of the version string on success
* else error code
*/
-static ssize_t zynqmp_pm_debugfs_api_read(struct file *file, char __user *ptr,
- size_t len, loff_t *off)
+static ssize_t zynqmp_pm_debugfs_api_read(struct kiocb *iocb,
+ struct iov_iter *to)
{
- return simple_read_from_buffer(ptr, len, off, debugfs_buf,
- strlen(debugfs_buf));
+ return simple_copy_to_iter(debugfs_buf, &iocb->ki_pos,
+ strlen(debugfs_buf), to);
}
/* Setup debugfs fops */
static const struct file_operations fops_zynqmp_pm_dbgfs = {
.owner = THIS_MODULE,
- .write = zynqmp_pm_debugfs_api_write,
- .read = zynqmp_pm_debugfs_api_read,
+ .write_iter = zynqmp_pm_debugfs_api_write,
+ .read_iter = zynqmp_pm_debugfs_api_read,
};
/**
--
2.43.0