aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans Verkuil <hans.verkuil@cisco.com>2015-03-09 12:33:57 -0400
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>2015-04-02 22:29:01 -0400
commit3ae863e0db47ae7815f9e52975e1fddfca59520a (patch)
treef6b8076f90b5311a8e3335fa6a750f8676a6ecde
parent093654201e209b2a1aa59bd6c0bc1e33c1f6c4d2 (diff)
[media] saa7146: embed video_device
Embed the video_device struct to simplify the error handling and in order to (eventually) get rid of video_device_alloc/release. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
-rw-r--r--drivers/media/common/saa7146/saa7146_fops.c19
-rw-r--r--drivers/media/pci/saa7146/hexium_gemini.c2
-rw-r--r--drivers/media/pci/saa7146/hexium_orion.c2
-rw-r--r--drivers/media/pci/saa7146/mxb.c4
-rw-r--r--drivers/media/pci/ttpci/av7110.h4
-rw-r--r--drivers/media/pci/ttpci/budget-av.c2
-rw-r--r--include/media/saa7146_vv.h4
7 files changed, 13 insertions, 24 deletions
diff --git a/drivers/media/common/saa7146/saa7146_fops.c b/drivers/media/common/saa7146/saa7146_fops.c
index b7d63933dae6..df1e8c975cd8 100644
--- a/drivers/media/common/saa7146/saa7146_fops.c
+++ b/drivers/media/common/saa7146/saa7146_fops.c
@@ -587,26 +587,20 @@ int saa7146_vv_release(struct saa7146_dev* dev)
587} 587}
588EXPORT_SYMBOL_GPL(saa7146_vv_release); 588EXPORT_SYMBOL_GPL(saa7146_vv_release);
589 589
590int saa7146_register_device(struct video_device **vid, struct saa7146_dev* dev, 590int saa7146_register_device(struct video_device *vfd, struct saa7146_dev *dev,
591 char *name, int type) 591 char *name, int type)
592{ 592{
593 struct video_device *vfd;
594 int err; 593 int err;
595 int i; 594 int i;
596 595
597 DEB_EE("dev:%p, name:'%s', type:%d\n", dev, name, type); 596 DEB_EE("dev:%p, name:'%s', type:%d\n", dev, name, type);
598 597
599 // released by vfd->release
600 vfd = video_device_alloc();
601 if (vfd == NULL)
602 return -ENOMEM;
603
604 vfd->fops = &video_fops; 598 vfd->fops = &video_fops;
605 if (type == VFL_TYPE_GRABBER) 599 if (type == VFL_TYPE_GRABBER)
606 vfd->ioctl_ops = &dev->ext_vv_data->vid_ops; 600 vfd->ioctl_ops = &dev->ext_vv_data->vid_ops;
607 else 601 else
608 vfd->ioctl_ops = &dev->ext_vv_data->vbi_ops; 602 vfd->ioctl_ops = &dev->ext_vv_data->vbi_ops;
609 vfd->release = video_device_release; 603 vfd->release = video_device_release_empty;
610 vfd->lock = &dev->v4l2_lock; 604 vfd->lock = &dev->v4l2_lock;
611 vfd->v4l2_dev = &dev->v4l2_dev; 605 vfd->v4l2_dev = &dev->v4l2_dev;
612 vfd->tvnorms = 0; 606 vfd->tvnorms = 0;
@@ -618,25 +612,20 @@ int saa7146_register_device(struct video_device **vid, struct saa7146_dev* dev,
618 err = video_register_device(vfd, type, -1); 612 err = video_register_device(vfd, type, -1);
619 if (err < 0) { 613 if (err < 0) {
620 ERR("cannot register v4l2 device. skipping.\n"); 614 ERR("cannot register v4l2 device. skipping.\n");
621 video_device_release(vfd);
622 return err; 615 return err;
623 } 616 }
624 617
625 pr_info("%s: registered device %s [v4l2]\n", 618 pr_info("%s: registered device %s [v4l2]\n",
626 dev->name, video_device_node_name(vfd)); 619 dev->name, video_device_node_name(vfd));
627
628 *vid = vfd;
629 return 0; 620 return 0;
630} 621}
631EXPORT_SYMBOL_GPL(saa7146_register_device); 622EXPORT_SYMBOL_GPL(saa7146_register_device);
632 623
633int saa7146_unregister_device(struct video_device **vid, struct saa7146_dev* dev) 624int saa7146_unregister_device(struct video_device *vfd, struct saa7146_dev *dev)
634{ 625{
635 DEB_EE("dev:%p\n", dev); 626 DEB_EE("dev:%p\n", dev);
636 627
637 video_unregister_device(*vid); 628 video_unregister_device(vfd);
638 *vid = NULL;
639
640 return 0; 629 return 0;
641} 630}
642EXPORT_SYMBOL_GPL(saa7146_unregister_device); 631EXPORT_SYMBOL_GPL(saa7146_unregister_device);
diff --git a/drivers/media/pci/saa7146/hexium_gemini.c b/drivers/media/pci/saa7146/hexium_gemini.c
index 366434f5647e..03cbcd2095c6 100644
--- a/drivers/media/pci/saa7146/hexium_gemini.c
+++ b/drivers/media/pci/saa7146/hexium_gemini.c
@@ -66,7 +66,7 @@ struct hexium
66{ 66{
67 int type; 67 int type;
68 68
69 struct video_device *video_dev; 69 struct video_device video_dev;
70 struct i2c_adapter i2c_adapter; 70 struct i2c_adapter i2c_adapter;
71 71
72 int cur_input; /* current input */ 72 int cur_input; /* current input */
diff --git a/drivers/media/pci/saa7146/hexium_orion.c b/drivers/media/pci/saa7146/hexium_orion.c
index a1eb26d11070..15f0d66ff78a 100644
--- a/drivers/media/pci/saa7146/hexium_orion.c
+++ b/drivers/media/pci/saa7146/hexium_orion.c
@@ -63,7 +63,7 @@ struct hexium_data
63struct hexium 63struct hexium
64{ 64{
65 int type; 65 int type;
66 struct video_device *video_dev; 66 struct video_device video_dev;
67 struct i2c_adapter i2c_adapter; 67 struct i2c_adapter i2c_adapter;
68 68
69 int cur_input; /* current input */ 69 int cur_input; /* current input */
diff --git a/drivers/media/pci/saa7146/mxb.c b/drivers/media/pci/saa7146/mxb.c
index c4c8fce8f2b4..0ca1e07ae783 100644
--- a/drivers/media/pci/saa7146/mxb.c
+++ b/drivers/media/pci/saa7146/mxb.c
@@ -151,8 +151,8 @@ static struct mxb_routing TEA6420_line[MXB_AUDIOS + 1][2] = {
151 151
152struct mxb 152struct mxb
153{ 153{
154 struct video_device *video_dev; 154 struct video_device video_dev;
155 struct video_device *vbi_dev; 155 struct video_device vbi_dev;
156 156
157 struct i2c_adapter i2c_adapter; 157 struct i2c_adapter i2c_adapter;
158 158
diff --git a/drivers/media/pci/ttpci/av7110.h b/drivers/media/pci/ttpci/av7110.h
index ef3d9606b269..835635b0c712 100644
--- a/drivers/media/pci/ttpci/av7110.h
+++ b/drivers/media/pci/ttpci/av7110.h
@@ -102,8 +102,8 @@ struct av7110 {
102 struct dvb_device dvb_dev; 102 struct dvb_device dvb_dev;
103 struct dvb_net dvb_net; 103 struct dvb_net dvb_net;
104 104
105 struct video_device *v4l_dev; 105 struct video_device v4l_dev;
106 struct video_device *vbi_dev; 106 struct video_device vbi_dev;
107 107
108 struct saa7146_dev *dev; 108 struct saa7146_dev *dev;
109 109
diff --git a/drivers/media/pci/ttpci/budget-av.c b/drivers/media/pci/ttpci/budget-av.c
index 0ba3875af22e..54c9910256f8 100644
--- a/drivers/media/pci/ttpci/budget-av.c
+++ b/drivers/media/pci/ttpci/budget-av.c
@@ -68,7 +68,7 @@ DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
68 68
69struct budget_av { 69struct budget_av {
70 struct budget budget; 70 struct budget budget;
71 struct video_device *vd; 71 struct video_device vd;
72 int cur_input; 72 int cur_input;
73 int has_saa7113; 73 int has_saa7113;
74 struct tasklet_struct ciintf_irq_tasklet; 74 struct tasklet_struct ciintf_irq_tasklet;
diff --git a/include/media/saa7146_vv.h b/include/media/saa7146_vv.h
index 944ecdf3530f..92766f77a5de 100644
--- a/include/media/saa7146_vv.h
+++ b/include/media/saa7146_vv.h
@@ -178,8 +178,8 @@ struct saa7146_use_ops {
178}; 178};
179 179
180/* from saa7146_fops.c */ 180/* from saa7146_fops.c */
181int saa7146_register_device(struct video_device **vid, struct saa7146_dev* dev, char *name, int type); 181int saa7146_register_device(struct video_device *vid, struct saa7146_dev *dev, char *name, int type);
182int saa7146_unregister_device(struct video_device **vid, struct saa7146_dev* dev); 182int saa7146_unregister_device(struct video_device *vid, struct saa7146_dev *dev);
183void saa7146_buffer_finish(struct saa7146_dev *dev, struct saa7146_dmaqueue *q, int state); 183void saa7146_buffer_finish(struct saa7146_dev *dev, struct saa7146_dmaqueue *q, int state);
184void saa7146_buffer_next(struct saa7146_dev *dev, struct saa7146_dmaqueue *q,int vbi); 184void saa7146_buffer_next(struct saa7146_dev *dev, struct saa7146_dmaqueue *q,int vbi);
185int saa7146_buffer_queue(struct saa7146_dev *dev, struct saa7146_dmaqueue *q, struct saa7146_buf *buf); 185int saa7146_buffer_queue(struct saa7146_dev *dev, struct saa7146_dmaqueue *q, struct saa7146_buf *buf);