]> pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
V4L/DVB (8791): v4l2-dev: do not clear the driver_data field
authorHans Verkuil <hverkuil@xs4all.nl>
Sun, 24 Aug 2008 14:18:47 +0000 (11:18 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Sun, 12 Oct 2008 11:36:54 +0000 (09:36 -0200)
The driver_data field of the device structure was zeroed, thus losing
this information. Many drivers set this up before calling
video_device_register, so we have to ensure that it isn't lost.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/video/v4l2-dev.c

index 1ec0a1a8fb73f2a962358d557c838b087254e7ab..99f7ee4bc503a1830573ac23ba1184cb4cb121ba 100644 (file)
@@ -226,6 +226,7 @@ int video_register_device_index(struct video_device *vfd, int type, int nr,
        int end;
        int ret;
        char *name_base;
+       void *priv = video_get_drvdata(vfd);
 
        /* the release callback MUST be present */
        BUG_ON(!vfd->release);
@@ -295,6 +296,9 @@ int video_register_device_index(struct video_device *vfd, int type, int nr,
 
        /* sysfs class */
        memset(&vfd->dev, 0, sizeof(vfd->dev));
+       /* The memset above cleared the device's drvdata, so
+          put back the copy we made earlier. */
+       video_set_drvdata(vfd, priv);
        vfd->dev.class = &video_class;
        vfd->dev.devt = MKDEV(VIDEO_MAJOR, vfd->minor);
        if (vfd->parent)