[PATCH 141/437] drm: nouveau: convert to read/write iterators

Jens Axboe
2024-04-11T15:35:36Z

drivers/gpu/drm/nouveau/dispnv50/crc.c | 13 ++++++-------
drivers/gpu/drm/nouveau/nouveau_debugfs.c | 12 ++++++------
2 files changed, 12 insertions(+), 13 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/dispnv50/crc.c b/drivers/gpu/drm/nouveau/dispnv50/crc.c
index 9c942fbd836d..a7859e3cb39d 100644
--- a/drivers/gpu/drm/nouveau/dispnv50/crc.c
+++ b/drivers/gpu/drm/nouveau/dispnv50/crc.c
@@ -648,11 +648,9 @@ nv50_crc_debugfs_flip_threshold_open(struct inode *inode, struct file *file)
}

static ssize_t
-nv50_crc_debugfs_flip_threshold_set(struct file *file,
- const char __user *ubuf, size_t len,
- loff_t *offp)
+nv50_crc_debugfs_flip_threshold_set(struct kiocb *iocb, struct iov_iter *from)
{
- struct seq_file *m = file->private_data;
+ struct seq_file *m = iocb->ki_filp->private_data;
struct nv50_head *head = m->private;
struct nv50_head_atom *armh;
struct drm_crtc *crtc = &head->base.base;
@@ -660,9 +658,10 @@ nv50_crc_debugfs_flip_threshold_set(struct file *file,
struct nv50_crc *crc = &head->crc;
const struct nv50_crc_func *func =
nv50_disp(crtc->dev)->core->func->crc;
+ size_t len = iov_iter_count(from);
int value, ret;

- ret = kstrtoint_from_user(ubuf, len, 10, &value);
+ ret = kstrtoint_from_iter(from, len, 10, &value);
if (ret)
return ret;

@@ -697,8 +696,8 @@ nv50_crc_debugfs_flip_threshold_set(struct file *file,
static const struct file_operations nv50_crc_flip_threshold_fops = {
.owner = THIS_MODULE,
.open = nv50_crc_debugfs_flip_threshold_open,
- .read = seq_read,
- .write = nv50_crc_debugfs_flip_threshold_set,
+ .read_iter = seq_read_iter,
+ .write_iter = nv50_crc_debugfs_flip_threshold_set,
.release = single_release,
};

diff --git a/drivers/gpu/drm/nouveau/nouveau_debugfs.c b/drivers/gpu/drm/nouveau/nouveau_debugfs.c
index e83db051e851..02cfac6f6c39 100644
--- a/drivers/gpu/drm/nouveau/nouveau_debugfs.c
+++ b/drivers/gpu/drm/nouveau/nouveau_debugfs.c
@@ -139,14 +139,14 @@ nouveau_debugfs_pstate_get(struct seq_file *m, void *data)
}

static ssize_t
-nouveau_debugfs_pstate_set(struct file *file, const char __user *ubuf,
- size_t len, loff_t *offp)
+nouveau_debugfs_pstate_set(struct kiocb *iocb, struct iov_iter *from)
{
- struct seq_file *m = file->private_data;
+ struct seq_file *m = iocb->ki_filp->private_data;
struct drm_device *drm = m->private;
struct nouveau_debugfs *debugfs = nouveau_debugfs(drm);
struct nvif_control_pstate_user_v0 args = { .pwrsrc = -EINVAL };
char buf[32] = {}, *tmp, *cur = buf;
+ size_t len = iov_iter_count(from);
long value, ret;

if (!debugfs)
@@ -155,7 +155,7 @@ nouveau_debugfs_pstate_set(struct file *file, const char __user *ubuf,
if (len >= sizeof(buf))
return -EINVAL;

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

if ((tmp = strchr(buf, '\n')))
@@ -244,8 +244,8 @@ nouveau_debugfs_gpuva(struct seq_file *m, void *data)
static const struct file_operations nouveau_pstate_fops = {
.owner = THIS_MODULE,
.open = nouveau_debugfs_pstate_open,
- .read = seq_read,
- .write = nouveau_debugfs_pstate_set,
+ .read_iter = seq_read_iter,
+ .write_iter = nouveau_debugfs_pstate_set,
.release = single_release,
};

--
2.43.0