diff options
-rw-r--r-- | linux/drivers/media/common/saa7146_fops.c | 39 | ||||
-rw-r--r-- | linux/drivers/media/dvb/ttpci/av7110.h | 4 | ||||
-rw-r--r-- | linux/drivers/media/dvb/ttpci/budget-av.c | 2 | ||||
-rw-r--r-- | linux/include/media/saa7146_vv.h | 4 |
4 files changed, 31 insertions, 18 deletions
diff --git a/linux/drivers/media/common/saa7146_fops.c b/linux/drivers/media/common/saa7146_fops.c index 329e6c436..5c6714dcc 100644 --- a/linux/drivers/media/common/saa7146_fops.c +++ b/linux/drivers/media/common/saa7146_fops.c @@ -506,45 +506,58 @@ int saa7146_vv_release(struct saa7146_dev* dev) return 0; } -int saa7146_register_device(struct video_device *vid, struct saa7146_dev* dev, char *name, int type) +int saa7146_register_device(struct video_device **vid, struct saa7146_dev* dev, + char *name, int type) { struct saa7146_vv *vv = dev->vv_data; + struct video_device *vfd; DEB_EE(("dev:%p, name:'%s', type:%d\n",dev,name,type)); - - *vid = device_template; - strlcpy(vid->name, name, sizeof(vid->name)); - vid->priv = dev; + + // released by vfd->release + vfd = video_device_alloc(); + if (vfd == NULL) + return -ENOMEM; + + memcpy(vfd, &device_template, sizeof(struct video_device)); + strlcpy(vfd->name, name, sizeof(vfd->name)); + vfd->release = video_device_release; + vfd->priv = dev; // fixme: -1 should be an insmod parameter *for the extension* (like "video_nr"); - if (video_register_device(vid,type,-1) < 0) { + if (video_register_device(vfd, type, -1) < 0) { ERR(("cannot register v4l2 device. skipping.\n")); return -1; } if( VFL_TYPE_GRABBER == type ) { - vv->video_minor = vid->minor; - INFO(("%s: registered device video%d [v4l2]\n", dev->name,vid->minor & 0x1f)); + vv->video_minor = vfd->minor; + INFO(("%s: registered device video%d [v4l2]\n", + dev->name, vfd->minor & 0x1f)); } else { - vv->vbi_minor = vid->minor; - INFO(("%s: registered device vbi%d [v4l2]\n", dev->name,vid->minor & 0x1f)); + vv->vbi_minor = vfd->minor; + INFO(("%s: registered device vbi%d [v4l2]\n", + dev->name, vfd->minor & 0x1f)); } + *vid = vfd; return 0; } -int saa7146_unregister_device(struct video_device *vid, struct saa7146_dev* dev) +int saa7146_unregister_device(struct video_device **vid, struct saa7146_dev* dev) { struct saa7146_vv *vv = dev->vv_data; DEB_EE(("dev:%p\n",dev)); - if( VFL_TYPE_GRABBER == vid->type ) { + if( VFL_TYPE_GRABBER == (*vid)->type ) { vv->video_minor = -1; } else { vv->vbi_minor = -1; } - video_unregister_device(vid); + + video_unregister_device(*vid); + *vid = NULL; return 0; } diff --git a/linux/drivers/media/dvb/ttpci/av7110.h b/linux/drivers/media/dvb/ttpci/av7110.h index 0caf85cba..84eaa6310 100644 --- a/linux/drivers/media/dvb/ttpci/av7110.h +++ b/linux/drivers/media/dvb/ttpci/av7110.h @@ -61,8 +61,8 @@ struct av7110 { struct dvb_device dvb_dev; struct dvb_net dvb_net; - struct video_device v4l_dev; - struct video_device vbi_dev; + struct video_device *v4l_dev; + struct video_device *vbi_dev; struct saa7146_dev *dev; diff --git a/linux/drivers/media/dvb/ttpci/budget-av.c b/linux/drivers/media/dvb/ttpci/budget-av.c index 520d5372c..9520f9f1f 100644 --- a/linux/drivers/media/dvb/ttpci/budget-av.c +++ b/linux/drivers/media/dvb/ttpci/budget-av.c @@ -35,7 +35,7 @@ struct budget_av { struct budget budget; - struct video_device vd; + struct video_device *vd; int cur_input; int has_saa7113; }; diff --git a/linux/include/media/saa7146_vv.h b/linux/include/media/saa7146_vv.h index b32326295..c77eb8915 100644 --- a/linux/include/media/saa7146_vv.h +++ b/linux/include/media/saa7146_vv.h @@ -189,8 +189,8 @@ struct saa7146_use_ops { }; /* from saa7146_fops.c */ -int saa7146_register_device(struct video_device *vid, struct saa7146_dev* dev, char *name, int type); -int saa7146_unregister_device(struct video_device *vid, struct saa7146_dev* dev); +int saa7146_register_device(struct video_device **vid, struct saa7146_dev* dev, char *name, int type); +int saa7146_unregister_device(struct video_device **vid, struct saa7146_dev* dev); void saa7146_buffer_finish(struct saa7146_dev *dev, struct saa7146_dmaqueue *q, int state); void saa7146_buffer_next(struct saa7146_dev *dev, struct saa7146_dmaqueue *q,int vbi); int saa7146_buffer_queue(struct saa7146_dev *dev, struct saa7146_dmaqueue *q, struct saa7146_buf *buf); |