]> git.karo-electronics.de Git - linux-beck.git/commitdiff
[media] em28xx: move struct v4l2_ctrl_handler ctrl_handler from struct em28xx to...
authorFrank Schaefer <fschaefer.oss@googlemail.com>
Mon, 24 Mar 2014 19:33:10 +0000 (16:33 -0300)
committerMauro Carvalho Chehab <m.chehab@samsung.com>
Fri, 23 May 2014 16:08:01 +0000 (13:08 -0300)
Controls are only applicable to V4L2 module. Move the corresponding
data structs to the proper place.

Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
drivers/media/usb/em28xx/em28xx-video.c
drivers/media/usb/em28xx/em28xx.h

index 814403dee0438377c72b61bf0a72bc29706b87ec..a8ddc4cada95979a9157697978e7954b75fb9357 100644 (file)
@@ -1134,7 +1134,9 @@ static void em28xx_ctrl_notify(struct v4l2_ctrl *ctrl, void *priv)
 
 static int em28xx_s_ctrl(struct v4l2_ctrl *ctrl)
 {
-       struct em28xx *dev = container_of(ctrl->handler, struct em28xx, ctrl_handler);
+       struct em28xx_v4l2 *v4l2 =
+                 container_of(ctrl->handler, struct em28xx_v4l2, ctrl_handler);
+       struct em28xx *dev = v4l2->dev;
        int ret = -EINVAL;
 
        switch (ctrl->id) {
@@ -1845,6 +1847,7 @@ void em28xx_free_v4l2(struct kref *ref)
 {
        struct em28xx_v4l2 *v4l2 = container_of(ref, struct em28xx_v4l2, ref);
 
+       v4l2->dev->v4l2 = NULL;
        kfree(v4l2);
 }
 
@@ -1964,7 +1967,7 @@ static int em28xx_v4l2_fini(struct em28xx *dev)
                video_unregister_device(dev->vdev);
        }
 
-       v4l2_ctrl_handler_free(&dev->ctrl_handler);
+       v4l2_ctrl_handler_free(&v4l2->ctrl_handler);
        v4l2_device_unregister(&v4l2->v4l2_dev);
 
        if (dev->clk) {
@@ -2272,7 +2275,7 @@ static int em28xx_v4l2_init(struct em28xx *dev)
        u8 val;
        int ret;
        unsigned int maxw;
-       struct v4l2_ctrl_handler *hdl = &dev->ctrl_handler;
+       struct v4l2_ctrl_handler *hdl;
        struct em28xx_v4l2 *v4l2;
 
        if (dev->is_audio_only) {
@@ -2296,6 +2299,7 @@ static int em28xx_v4l2_init(struct em28xx *dev)
                return -ENOMEM;
        }
        kref_init(&v4l2->ref);
+       v4l2->dev = dev;
        dev->v4l2 = v4l2;
 
        ret = v4l2_device_register(&dev->udev->dev, &v4l2->v4l2_dev);
@@ -2304,6 +2308,7 @@ static int em28xx_v4l2_init(struct em28xx *dev)
                goto err;
        }
 
+       hdl = &v4l2->ctrl_handler;
        v4l2_ctrl_handler_init(hdl, 8);
        v4l2->v4l2_dev.ctrl_handler = hdl;
 
@@ -2590,7 +2595,7 @@ static int em28xx_v4l2_init(struct em28xx *dev)
        return 0;
 
 unregister_dev:
-       v4l2_ctrl_handler_free(&dev->ctrl_handler);
+       v4l2_ctrl_handler_free(&v4l2->ctrl_handler);
        v4l2_device_unregister(&v4l2->v4l2_dev);
 err:
        dev->v4l2 = NULL;
index 05deb84f70bb340dbbe609778fd2b29eb58ee007..24b2a9a73366c8d60c91430ba869fb5774d99550 100644 (file)
@@ -500,8 +500,10 @@ struct em28xx_eeprom {
 
 struct em28xx_v4l2 {
        struct kref ref;
+       struct em28xx *dev;
 
        struct v4l2_device v4l2_dev;
+       struct v4l2_ctrl_handler ctrl_handler;
 };
 
 struct em28xx_audio {
@@ -567,7 +569,6 @@ struct em28xx {
        unsigned int has_alsa_audio:1;
        unsigned int is_audio_only:1;
 
-       struct v4l2_ctrl_handler ctrl_handler;
        struct v4l2_clk *clk;
        struct em28xx_board board;