Subject: Re: Time to fix a 25 year old misdesign
To: NetBSD Kernel Technical Discussion List <tech-kern@NetBSD.ORG>
From: Lennart Augustsson <firstname.lastname@example.org>
Date: 10/15/2000 17:47:22
"Greg A. Woods" wrote:
> [ On Sunday, October 15, 2000 at 12:12:28 (+0200), Lennart Augustsson wrote: ]
> > Subject: Time to fix a 25 year old misdesign
> > But the audio device can actually be viewed as two
> > devices: one for playback and one for recording.
> Exactly. You're proposing to fix the wrong problem.
Well, sometimes you want to view it that way, but sometimes you just want
to view it as a single device. And that goes even more for USB ugen devices.
> The Unix design is still right. The dev_close() routine must be called
> only once because its sole purpose is to perform device specific actions
> on the hardware that will shut down the hardware properly when there are
> no other descriptors open to the device.
I claim that the design is wrong regardless of how you view it. The reason is
the lack of symmetry. There should be a match between open() and close().
If you also claim that dev_open() should be called only once because
it performs initialization that only needs to be done when the device is first
opened, then I'd buy your argument.
> The design of the audio driver is what's wrong. It must be separated
> logically into different drivers that have unique functionality and once
> that's done there'll be no need to call dev_close() more than once (and
> indeed there'll be more reasons to only call it once!).
Well, I don't think we have the option of changing that. There's too much
software out there that expects the current design. So you just suggest
replacing one problem with a worse problem. :)