[media] saa7164: add v4l2_device and replace parent with v4l2_dev
authorHans Verkuil <hans.verkuil@cisco.com>
Wed, 12 Jun 2013 08:49:50 +0000 (05:49 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Fri, 21 Jun 2013 14:03:39 +0000 (11:03 -0300)
This driver did not yet support struct v4l2_device, so add it. This
make it possible to replace the deprecated parent field with the
v4l2_dev field, allowing the eventual removal of the parent field.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/pci/saa7164/saa7164-core.c
drivers/media/pci/saa7164/saa7164-encoder.c
drivers/media/pci/saa7164/saa7164-vbi.c
drivers/media/pci/saa7164/saa7164.h

index 7618fdae811e3b28264de314c43fe8c6996a8ae9..5d27865784c52162eb264926d41bb8829228cbc4 100644 (file)
@@ -1196,6 +1196,11 @@ static int saa7164_initdev(struct pci_dev *pci_dev,
        if (NULL == dev)
                return -ENOMEM;
 
+       if (v4l2_device_register(&pci_dev->dev, &dev->v4l2_dev)) {
+               dev_err(&pci_dev->dev, "v4l2_device_register failed\n");
+               goto fail_free;
+       }
+
        /* pci init */
        dev->pci = pci_dev;
        if (pci_enable_device(pci_dev)) {
@@ -1367,6 +1372,7 @@ fail_fw:
 fail_irq:
        saa7164_dev_unregister(dev);
 fail_free:
+       v4l2_device_unregister(&dev->v4l2_dev);
        kfree(dev);
        return err;
 }
@@ -1439,6 +1445,7 @@ static void saa7164_finidev(struct pci_dev *pci_dev)
        mutex_unlock(&devlist);
 
        saa7164_dev_unregister(dev);
+       v4l2_device_unregister(&dev->v4l2_dev);
        kfree(dev);
 }
 
index 7b7ed97b85037be0124d07022e49d331f2080580..9266965412c34d0c7020dd913bdd04813fdb5829 100644 (file)
@@ -1348,7 +1348,7 @@ static struct video_device *saa7164_encoder_alloc(
        snprintf(vfd->name, sizeof(vfd->name), "%s %s (%s)", dev->name,
                type, saa7164_boards[dev->board].name);
 
-       vfd->parent  = &pci->dev;
+       vfd->v4l2_dev  = &dev->v4l2_dev;
        vfd->release = video_device_release;
        return vfd;
 }
index 552c01ad9f6305477fd3b00b4ae37c7132b9f28d..6e025fea25422774ae478633c7038cd978c1fbf3 100644 (file)
@@ -1297,7 +1297,7 @@ static struct video_device *saa7164_vbi_alloc(
        snprintf(vfd->name, sizeof(vfd->name), "%s %s (%s)", dev->name,
                type, saa7164_boards[dev->board].name);
 
-       vfd->parent  = &pci->dev;
+       vfd->v4l2_dev  = &dev->v4l2_dev;
        vfd->release = video_device_release;
        return vfd;
 }
index 2df47ea28289fb1b537797e89cb406afbd9298b4..8b29e89903014b4fbf4b0ab9a0f76f90f416280c 100644 (file)
@@ -63,6 +63,7 @@
 #include <dmxdev.h>
 #include <media/v4l2-common.h>
 #include <media/v4l2-ioctl.h>
+#include <media/v4l2-device.h>
 
 #include "saa7164-reg.h"
 #include "saa7164-types.h"
@@ -427,6 +428,8 @@ struct saa7164_dev {
        struct list_head        devlist;
        atomic_t                refcount;
 
+       struct v4l2_device v4l2_dev;
+
        /* pci stuff */
        struct pci_dev  *pci;
        unsigned char   pci_rev, pci_lat;