Re: [RFC/PATCH] sysfs'ify video4linux

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



> > ... if a ->release() callback is required anyway to fix it?  I see two
> > ways to handle it:
> > 
> >   (1) mandatory ->release() callback, drivers must make sure the stuff
> >       is not freed before the callback was called.  In that case the
> >       class_device can be left embedded inside the drivers provate
> >       structs.
> 
> That sounds fine, and is the same as what I did for usb host devices.

Ok.

> >   (2) optional ->release() callback (for those drivers which want add
> >       private attributes), "struct video_device" must be moved out of
> >       the drivers private structs then and released in a new function
> >       (which also calls the drivers ->release callback if present).
> >       Should probably also be allocated by videodev.c for symmetry.
> 
> That's "prettier", but probably requires a lot more work in every v4l
> driver, right?

Not sure which of them is actually more work.

Version (1) can be done without breaking the build, with a hack along 
the lines "if (no release callback) printk(KERN_WARN please fix your
driver)", so the drivers can be fixed step-by-step afterwards.

Fixing the drivers might be non-trivial through.  Some drivers are
hot-pluggable (usb cams), some drivers register more than one v4l device
(bttv wants up to three).  Those drivers can't just call kfree() in the
->release callback because there might be other references, some open
file handle for a unplugged usb cam, another not-yet unregistered
v4l device, whatever.  Probably they must implement some reference
counting scheme to get that right.  The very simple ones (in
drivers/media/radio for example) likely just need the kfree() moved
from the ->remove function into the new ->release() callback.

Version (2) needs every v4l driver touched to make it compile again.
Not sure how hard it is to fixup them.  I'd guess it is pretty straigt
forward to do the conversion, it's just alot of work.  I also could do
a number of other cleanups along the way.  Maybe I trap into some hidden
pitfalls through, havn't looked at all the drivers in detail yet.

  Gerd

-- 
sigfault




[Index of Archives]     [Linux DVB]     [Video Disk Recorder]     [Asterisk]     [Photo]     [DCCP]     [Netdev]     [Xorg]     [Util Linux NG]     [Xfree86]     [Free Photo Albums]     [Fedora Users]     [Fedora Women]     [ALSA Users]     [ALSA Devel]     [Linux USB]

Powered by Linux