• Gerd Knorr's avatar
    [PATCH] videodev redesign · 154feaef
    Gerd Knorr authored
    This patch is a redesign for videodev.[ch].  Changes:
    
    - drop the function pointers (read/write/mmap/poll/...) from struct
      video_device, use struct file_operations directly instead.
      Dispatching to different drivers by minor number is done the same way
      soundcore.o handles this: swap file->f_fops at open() time.
    
    - also drop the now obsolete video_red/write/mmap/poll/...  functions
      from videodev.c
    
    - Stop using the BKL, use a mutex to protect open,register+unregister
      calls against races.
    
    - provide a video_generic_ioctl() function which can (and should) be
      used by v4l drivers to handle copying from and to userspace.
    
    - provide video_exclusive_open/release functions which can be used by
      v4l drivers to make sure only one process at a time opens the
      device.  They can be hooked directly into struct file_operations if
      some driver has nothing to initialize at open time (which is true
      for many drivers in drivers/media/radio/).
    
    The move from function pointers in struct video_device to struct
    file_operations does break all existing v4l drivers.  Thus I have a
    large number of patches for the drivers in the kernel tree.  Most of it
    is just the adoption to the videodev.[ch] changes, but I've also fixed a
    small bug there and there while walking througth the source files.
    154feaef
videodev.c 11.8 KB