From: Andy Shevchenko <andriy.shevchenko@intel.com>
To: Joshua Crofts <joshua.crofts1@gmail.com>
Cc: linux-kernel@vger.kernel.org, linux-media@vger.kernel.org,
linux-staging@lists.linux.dev
Subject: Re: [RFC] media: atomisp: change copy_from_compatible to iov_iter
Date: Wed, 8 Apr 2026 17:29:45 +0300 [thread overview]
Message-ID: <adZmWZ0SXRhHPyQ9@ashevche-desk.local> (raw)
In-Reply-To: <adZlX-5rx0jtIMpD@ashevche-desk.local>
On Wed, Apr 08, 2026 at 05:25:39PM +0300, Andy Shevchenko wrote:
> On Wed, Apr 08, 2026 at 01:46:11PM +0000, Joshua Crofts wrote:
> > Since the atomisp driver concerns transferring video
> > data, it would probably be better to use an iov_iter
> > than copy_to_user calls (scatter-gather i/o and better
> > pointer safety). Per yesterday's emails, I'm sending an
> > an example of a function in atomisp_cmd.c where I've
> > implemented iov_iter usage.
> >
> > Note, this isn't a patch, more of a question whether this
> > style of changing the copy_to_user calls is valid (or if
> > I'm writing garbage code). I'd rather get your opinion
> > than submitting a patch first.
Sure, see below.
...
> > - ret = copy_to_user(config->data, asd->params.s3a_user_stat->data,
> > - asd->params.s3a_output_bytes);
> > - if (ret) {
> > - dev_err(isp->dev, "copy to user failed: copied %lu bytes\n",
> > - ret);
> > + ret = import_ubuf(ITER_DEST, (void __user *)config->data, asd->params.s3a_output_bytes, &iter);
> > + if (ret)
> > + return ret;
> > +
> > + if (copy_to_iter(asd->params.s3a_user_stat->data, asd->params.s3a_output_bytes, &iter) != asd->params.s3a_output_bytes)
> > return -EFAULT;
> > - }
>
> It doesn't change any architectural decision here. Basically you need to have
> s3a_output_bytes to be already iov_iter at this point. So, import_ubuf() has to
> happen somewhere else.
Brief grepping shows this
/*
* Intermediate buffers used to communicate data between
* CSS and user space.
*/
struct ia_css_3a_statistics *s3a_user_stat;
which suggests that iov_iter should be somewhere here, in the struct
atomisp_subdev_params. But you need to read much more code and get familiar
with this. I wouldn't expect any meaningful change by a few days, maybe by
a few weeks as this driver is quite complicated.
In any case, thanks into trying with this, will be very appreciated
when the task is logically finished.
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2026-04-08 14:29 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-07 14:46 [RFC] staging: media: atomisp: change copy_from_compatible to iov_iter Joshua Crofts
2026-04-07 15:06 ` Andy Shevchenko
2026-04-07 15:12 ` Andy Shevchenko
2026-04-08 13:46 ` [RFC] " Joshua Crofts
2026-04-08 13:50 ` Joshua Crofts
2026-04-08 14:25 ` Andy Shevchenko
2026-04-08 14:29 ` Andy Shevchenko [this message]
2026-04-08 14:43 ` Joshua Crofts
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=adZmWZ0SXRhHPyQ9@ashevche-desk.local \
--to=andriy.shevchenko@intel.com \
--cc=joshua.crofts1@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox