On Tue, 2008-05-27 at 20:46 -0400, Devin Heitmueller wrote:
I don't think a lock would be good for MythTV or any other app that
open()s multiple nodes at once. How can an app know that it's
dead-locking or barring itself via the kernel driver?
Maybe return an EBUSY or E-something else for these cases when Myth
tries to open() the second device node, when there's an underlying
factor that requires things to be mutually exclusive. Allowing things
like read() to allow hardware mode switching between analog and digital
seems like it could result in really weird behaviors at the application.
I'll cite a precedent:
ivtv returns EBUSY on open() when there's a conflict with it's various
analog devices nodes that depend on the same underlying hardware: MPG,
YUV, FM Radio, etc.
I note the man page for open() doesn't list EBUSY as a valid errno.
However, the V4L2 API Spec does list EBUSY as a valid errno for V4L2
open().
I like to blame MythTV for a lot of things. ;)
But in this case I can't. The driver probably shouldn't hold a lock and
suspend an open() indefinitely (IMO). It should say the device is BUSY
as that is the truth: an underlying hardware device or resource is busy.
Regards,
Andy
--