[PATCH 210/437] drivers/iommu: convert intel iommu to read/write iterators

Jens Axboe
2024-04-11T15:37:33Z

drivers/iommu/intel/debugfs.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/iommu/intel/debugfs.c b/drivers/iommu/intel/debugfs.c
index 86b506af7daa..8655098a3a17 100644
--- a/drivers/iommu/intel/debugfs.c
+++ b/drivers/iommu/intel/debugfs.c
@@ -679,19 +679,19 @@ static int dmar_perf_latency_open(struct inode *inode, struct file *filp)
return single_open(filp, latency_show, NULL);
}

-static ssize_t dmar_perf_latency_write(struct file *filp,
- const char __user *ubuf,
- size_t cnt, loff_t *ppos)
+static ssize_t dmar_perf_latency_write(struct kiocb *iocb,
+ struct iov_iter *from)
{
struct dmar_drhd_unit *drhd;
struct intel_iommu *iommu;
+ size_t cnt = iov_iter_count(from);
int counting;
char buf[64];

if (cnt > 63)
cnt = 63;

- if (copy_from_user(&buf, ubuf, cnt))
+ if (!copy_from_iter_full(&buf, cnt, from))
return -EFAULT;

buf[cnt] = 0;
@@ -738,14 +738,14 @@ static ssize_t dmar_perf_latency_write(struct file *filp,
return -EINVAL;
}

- *ppos += cnt;
+ iocb->ki_pos += cnt;
return cnt;
}

static const struct file_operations dmar_perf_latency_fops = {
.open = dmar_perf_latency_open,
- .write = dmar_perf_latency_write,
- .read = seq_read,
+ .write_iter = dmar_perf_latency_write,
+ .read_iter = seq_read_iter,
.llseek = seq_lseek,
.release = single_release,
};
--
2.43.0