[cpia] I Solved all the QX3 Microscope problems (2.4up)

Nick Holloway Nick.Holloway@pyrites.org.uk
5 Feb 2002 08:04:23 -0000


sam102@crpud.net (Sam Alexander) writes:
> Change this:
> static struct video_device cpia_template = {
>         "CPiA Camera",
>         VID_TYPE_CAPTURE,
>         VID_HARDWARE_CPIA,
[...]
> 
> To this:
> static struct video_device cpia_template = {
>         THIS_MODULE,
>         "CPiA Camera",
>         VID_TYPE_CAPTURE,
>         VID_HARDWARE_CPIA,
[...]

A better fix would be to used the named initialisers for the structure.
This is how the cpia_template would be initialised:

    static struct video_device cpia_template = {
	    module:      THIS_MODULE,
	    name:        "CPiA Camera",
	    type:        VID_TYPE_CAPTURE,
	    hardware:    VID_HARDWARE_CPIA,
	    open:        cpia_open,              /* open */
	    close:       cpia_close,             /* close */
	    read:        cpia_read,              /* read */
	    ioctl:       cpia_ioctl,             /* ioctl */
	    mmap:        cpia_mmap,              /* mmap */
	    initialize:  cpia_video_init,        /* initialize */
	    minor:       -1                      /* minor - unset */
    };

This means you are protected from new members being added.  This is the
approach being used elsewhere in the kernel.

-- 
 `O O'  | Nick.Holloway@pyrites.org.uk
// ^ \\ | http://www.pyrites.org.uk/