Re: What is up with drivers/sound?

Michael Elizabeth Chastain (mec@shout.net)
Sun, 4 Jan 1998 10:23:22 -0600


Good morning guys,

I took a closer look at 2.1.77 drivers/sound/*.

The original sound driver code has an ioctl handler that does this:

len = _SIOC_SIZE(cmd);
ptr = vmalloc (len);
copy_from_user (ptr, arg, len);
sound_ioctl_sw( ..., ptr );
copy_to_user (arg, ptr, len);
vfree (ptr);

The idea is that individual drivers deal with kernel memory space
rather than prickly user-space pointers.

The 2.1.77 patch changes the top-level code to:

sound_ioctl_sw( ..., arg );

Then all the individual drivers do copy_from_user and copy_to_user
as appropriate. This gets a vmalloc/vfree off the code path, and
also elides one data copy.

In order to make this work, Thomas Sailer edited every ioctl handler
in every driver.

There are several problems with this code:

(1) It's not even ready for testing. It has multiple compiler errors.

(2) Given that a lot of drivers won't compile in any configuration,
it follows they haven't been tested in any configuration. There's
a high probability we'll be picking up after broken ioctls for
weeks.

(3) It changes 6000 lines of sound driver code. This will make it
6000 lines harder to track Hannu Sovalainen's changes in the
future.

(4) With the current state of broken-ness, I can't test my own
Sound Module patch. This patch also touches a lot of files,
but most of my changes to *.h and *.c actually change the code
*back* to original OSS/Free code. I've gotten good feedback
from the field about this patch: three success reports and
two bug reports which, on investigation, turned out to be
user configuration errors.

I went and slept on the problem, and this is my recommendation
for 2.1.78:

cd drivers/sound
rm -r *
cp -a ~/linux-2.1.76/drivers/sound .

How about it, Alan? Linus?

Michael Chastain
<mailto:mec@shout.net>
"love without fear"