]> git.karo-electronics.de Git - linux-beck.git/commitdiff
[media] solo6x10: add v4l2_device
authorHans Verkuil <hans.verkuil@cisco.com>
Mon, 25 Mar 2013 08:36:44 +0000 (05:36 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Mon, 25 Mar 2013 11:40:29 +0000 (08:40 -0300)
Add support for struct v4l2_device.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/staging/media/solo6x10/core.c
drivers/staging/media/solo6x10/solo6x10.h
drivers/staging/media/solo6x10/v4l2-enc.c
drivers/staging/media/solo6x10/v4l2.c

index 75d98cc61c40a0ea6a00d1d2d6e3845f110c8774..05ecd48e5507be2cb3b9bf07f73c9b6c6d809d5d 100644 (file)
@@ -181,6 +181,7 @@ static void free_solo_dev(struct solo_dev *solo_dev)
 
        pci_release_regions(pdev);
        pci_disable_device(pdev);
+       v4l2_device_unregister(&solo_dev->v4l2_dev);
        pci_set_drvdata(pdev, NULL);
 
        kfree(solo_dev);
@@ -511,7 +512,9 @@ static int solo_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
        solo_dev->type = id->driver_data;
        solo_dev->pdev = pdev;
        spin_lock_init(&solo_dev->reg_io_lock);
-       pci_set_drvdata(pdev, solo_dev);
+       ret = v4l2_device_register(&pdev->dev, &solo_dev->v4l2_dev);
+       if (ret)
+               goto fail_probe;
 
        /* Only for during init */
        solo_dev->p2m_jiffies = msecs_to_jiffies(100);
@@ -678,7 +681,8 @@ fail_probe:
 
 static void solo_pci_remove(struct pci_dev *pdev)
 {
-       struct solo_dev *solo_dev = pci_get_drvdata(pdev);
+       struct v4l2_device *v4l2_dev = pci_get_drvdata(pdev);
+       struct solo_dev *solo_dev = container_of(v4l2_dev, struct solo_dev, v4l2_dev);
 
        free_solo_dev(solo_dev);
 }
index d8d61deb72372548f52ceae2a78361634cc734a7..6501cb9afba3a1afdb6ee7a4f3f0786495602f37 100644 (file)
@@ -37,6 +37,7 @@
 #include <linux/videodev2.h>
 
 #include <media/v4l2-dev.h>
+#include <media/v4l2-device.h>
 #include <media/videobuf-core.h>
 
 #include "registers.h"
@@ -178,6 +179,7 @@ struct solo_dev {
        u32                     irq_mask;
        u32                     motion_mask;
        spinlock_t              reg_io_lock;
+       struct v4l2_device      v4l2_dev;
 
        /* tw28xx accounting */
        u8                      tw2865, tw2864, tw2815;
index bb5f1b82ddcdfc0cb9c9e53905de5243fa6845c5..d085e386e087acb1b29ca30fdd4ab88580665d84 100644 (file)
@@ -1670,7 +1670,7 @@ static struct solo_enc_dev *solo_enc_alloc(struct solo_dev *solo_dev,
        solo_enc->ch = ch;
 
        *solo_enc->vfd = solo_enc_template;
-       solo_enc->vfd->parent = &solo_dev->pdev->dev;
+       solo_enc->vfd->v4l2_dev = &solo_dev->v4l2_dev;
        ret = video_register_device(solo_enc->vfd, VFL_TYPE_GRABBER, nr);
        if (ret < 0) {
                video_device_release(solo_enc->vfd);
index 70da9e2187d2853f216264d58911d60489f3e048..33171161002fd53ee1ff5ab98ecad0c4487edf41 100644 (file)
@@ -823,7 +823,7 @@ int solo_v4l2_init(struct solo_dev *solo_dev, unsigned nr)
                return -ENOMEM;
 
        *solo_dev->vfd = solo_v4l2_template;
-       solo_dev->vfd->parent = &solo_dev->pdev->dev;
+       solo_dev->vfd->v4l2_dev = &solo_dev->v4l2_dev;
 
        ret = video_register_device(solo_dev->vfd, VFL_TYPE_GRABBER, nr);
        if (ret < 0) {