Re: [RFC/PATCH] sysfs'ify video4linux

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



> It looks like the video drivers include a "struct video_device"
> structure within their own structures, right?

Yes, it is allocated/freed by the driver, most seem to simply include
one ore more "struct video_device" somewhere in the per-device struct.

> That will have to be changed to a pointer to that structure in order
> for the lifetime rules to work properly.

Hmm.  I doubt it will be that simple.  struct video_device has a priv
field which can be used by the drivers to hook in some driver-private
data.  That may point into nowhere if struct video_device has a longer
live time due to some kobject still being referenced.  Wouldn't be a
issue for videodev.o itself, but might become a problem for drivers
which want add private properties and rely on video_device->priv
for finding the per-device data.  Problem isn't solved but justed
moved to the next corner ...

Maybe let video_unregister sleep on a semaphore which gets woken up
by the release function?  That should make sure the sysfs objects are
not referenced any more if video_unregister() returns.  I use a similar
method in some places when shutting down kernel threads, to make sure it
is really stopped before rmmod frees the memory.

> Look at the dev file in /sys/class/tty/*, or in /sys/block/hd* or in
> /sys/class/usb/*, and so on...

I've found the code in drivers/block/genhd.c in the meantime :)

  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