From: Takashi Iwai <tiwai@suse.de>
To: "Geoffrey D. Bennett" <g@b4.vu>
Cc: Takashi Iwai <tiwai@suse.de>, Takashi Iwai <tiwai@suse.com>,
linux-sound@vger.kernel.org
Subject: Re: [PATCH v3 0/2] ALSA: Add driver for big Scarlett 4th Gen interfaces
Date: Fri, 03 Jan 2025 18:07:32 +0100 [thread overview]
Message-ID: <878qrrzuzv.wl-tiwai@suse.de> (raw)
In-Reply-To: <cover.1735855597.git.g@b4.vu>
On Thu, 02 Jan 2025 23:38:07 +0100,
Geoffrey D. Bennett wrote:
>
> Hi Takashi,
>
> Static buffers in the ioctl structs didn't seem to be the right way to
> go, so I followed the instructions in
> Documentation/drivers-api/ioctl.rst and the ioctls now work with
> 32-bit userspace on 64-bit kernels.
Actually it's rather trivial if you use a variable length array and
passes the header to the ioctl struct. e.g.
struct fcp_cmd {
__u16 size;
__u16 resp_size;
u8 data[];
};
then you can simply do copy_from_user() from the data field. And
write back to the data field again for the response if resp_size is
non-zero, too.
The above can be used for most of your needed I/O in general, I
suppose.
> I added suspend/resume handling and all the suspend/resume cases that
> I tried now work too.
Thanks. The code used for suspend is same for the fcp_private_free(),
and they can be factored out.
Now, considering this implementation again, a fundamental question is
whether we really should go to this direction or not.
Usually the driver implements an ioctl per certain limited task
(except for some debugging purpose). But we open all doors fully.
This gives the most flexibility, of course. OTOH, it has a
significant risk that every program may screw up your device easily by
sending some malicious ioctls.
So one another possible way would be to provide more tailored ioctls
that are specific to each task. Or we may introduce some sanity
checks of the possible registers or whatever parameters instead of
accepting all as is. Of course those would decrease the flexibility;
when some new feature is needed, you'd need to adjust the kernel side
as well. That's the cost for safety.
I'm not sure about this design decision yet.
thanks,
Takashi
prev parent reply other threads:[~2025-01-03 17:07 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-02 22:38 [PATCH v3 0/2] ALSA: Add driver for big Scarlett 4th Gen interfaces Geoffrey D. Bennett
2025-01-02 22:38 ` [PATCH v3 1/2] ALSA: FCP: Add Focusrite Control Protocol driver Geoffrey D. Bennett
2025-01-02 22:38 ` [PATCH v3 2/2] ALSA: scarlett2: Add device_setup option to use FCP driver Geoffrey D. Bennett
2025-01-03 17:07 ` Takashi Iwai [this message]
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=878qrrzuzv.wl-tiwai@suse.de \
--to=tiwai@suse.de \
--cc=g@b4.vu \
--cc=linux-sound@vger.kernel.org \
--cc=tiwai@suse.com \
/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