Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3ae863e0 authored by Hans Verkuil's avatar Hans Verkuil Committed by Mauro Carvalho Chehab
Browse files

[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: default avatarHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@osg.samsung.com>
parent 09365420
Loading
Loading
Loading
Loading
+4 −15
Original line number Original line Diff line number Diff line
@@ -587,26 +587,20 @@ int saa7146_vv_release(struct saa7146_dev* dev)
}
}
EXPORT_SYMBOL_GPL(saa7146_vv_release);
EXPORT_SYMBOL_GPL(saa7146_vv_release);


int saa7146_register_device(struct video_device **vid, struct saa7146_dev* dev,
int saa7146_register_device(struct video_device *vfd, struct saa7146_dev *dev,
			    char *name, int type)
			    char *name, int type)
{
{
	struct video_device *vfd;
	int err;
	int err;
	int i;
	int i;


	DEB_EE("dev:%p, name:'%s', type:%d\n", dev, name, type);
	DEB_EE("dev:%p, name:'%s', type:%d\n", dev, name, type);


	// released by vfd->release
	vfd = video_device_alloc();
	if (vfd == NULL)
		return -ENOMEM;

	vfd->fops = &video_fops;
	vfd->fops = &video_fops;
	if (type == VFL_TYPE_GRABBER)
	if (type == VFL_TYPE_GRABBER)
		vfd->ioctl_ops = &dev->ext_vv_data->vid_ops;
		vfd->ioctl_ops = &dev->ext_vv_data->vid_ops;
	else
	else
		vfd->ioctl_ops = &dev->ext_vv_data->vbi_ops;
		vfd->ioctl_ops = &dev->ext_vv_data->vbi_ops;
	vfd->release = video_device_release;
	vfd->release = video_device_release_empty;
	vfd->lock = &dev->v4l2_lock;
	vfd->lock = &dev->v4l2_lock;
	vfd->v4l2_dev = &dev->v4l2_dev;
	vfd->v4l2_dev = &dev->v4l2_dev;
	vfd->tvnorms = 0;
	vfd->tvnorms = 0;
@@ -618,25 +612,20 @@ int saa7146_register_device(struct video_device **vid, struct saa7146_dev* dev,
	err = video_register_device(vfd, type, -1);
	err = video_register_device(vfd, type, -1);
	if (err < 0) {
	if (err < 0) {
		ERR("cannot register v4l2 device. skipping.\n");
		ERR("cannot register v4l2 device. skipping.\n");
		video_device_release(vfd);
		return err;
		return err;
	}
	}


	pr_info("%s: registered device %s [v4l2]\n",
	pr_info("%s: registered device %s [v4l2]\n",
		dev->name, video_device_node_name(vfd));
		dev->name, video_device_node_name(vfd));

	*vid = vfd;
	return 0;
	return 0;
}
}
EXPORT_SYMBOL_GPL(saa7146_register_device);
EXPORT_SYMBOL_GPL(saa7146_register_device);


int saa7146_unregister_device(struct video_device **vid, struct saa7146_dev* dev)
int saa7146_unregister_device(struct video_device *vfd, struct saa7146_dev *dev)
{
{
	DEB_EE("dev:%p\n", dev);
	DEB_EE("dev:%p\n", dev);


	video_unregister_device(*vid);
	video_unregister_device(vfd);
	*vid = NULL;

	return 0;
	return 0;
}
}
EXPORT_SYMBOL_GPL(saa7146_unregister_device);
EXPORT_SYMBOL_GPL(saa7146_unregister_device);
+1 −1
Original line number Original line Diff line number Diff line
@@ -66,7 +66,7 @@ struct hexium
{
{
	int type;
	int type;


	struct video_device	*video_dev;
	struct video_device	video_dev;
	struct i2c_adapter	i2c_adapter;
	struct i2c_adapter	i2c_adapter;


	int 		cur_input;	/* current input */
	int 		cur_input;	/* current input */
+1 −1
Original line number Original line Diff line number Diff line
@@ -63,7 +63,7 @@ struct hexium_data
struct hexium
struct hexium
{
{
	int type;
	int type;
	struct video_device	*video_dev;
	struct video_device	video_dev;
	struct i2c_adapter	i2c_adapter;
	struct i2c_adapter	i2c_adapter;


	int cur_input;	/* current input */
	int cur_input;	/* current input */
+2 −2
Original line number Original line Diff line number Diff line
@@ -151,8 +151,8 @@ static struct mxb_routing TEA6420_line[MXB_AUDIOS + 1][2] = {


struct mxb
struct mxb
{
{
	struct video_device	*video_dev;
	struct video_device	video_dev;
	struct video_device	*vbi_dev;
	struct video_device	vbi_dev;


	struct i2c_adapter	i2c_adapter;
	struct i2c_adapter	i2c_adapter;


+2 −2
Original line number Original line Diff line number Diff line
@@ -102,8 +102,8 @@ struct av7110 {
	struct dvb_device	dvb_dev;
	struct dvb_device	dvb_dev;
	struct dvb_net		dvb_net;
	struct dvb_net		dvb_net;


	struct video_device	*v4l_dev;
	struct video_device	v4l_dev;
	struct video_device	*vbi_dev;
	struct video_device	vbi_dev;


	struct saa7146_dev	*dev;
	struct saa7146_dev	*dev;


Loading