Skip to content

Commit

Permalink
V4L/DVB (10271): saa7146: convert to video_ioctl2.
Browse files Browse the repository at this point in the history
The conversion to video_ioctl2 is the first phase to converting this driver
to the latest v4l2 framework.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
  • Loading branch information
Hans Verkuil authored and Mauro Carvalho Chehab committed Mar 30, 2009
1 parent c9b8b04 commit b960074
Show file tree
Hide file tree
Showing 8 changed files with 1,404 additions and 1,510 deletions.
36 changes: 14 additions & 22 deletions drivers/media/common/saa7146_fops.c
Original file line number Diff line number Diff line change
Expand Up @@ -308,14 +308,6 @@ static int fops_release(struct file *file)
return 0;
}

static long fops_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{
/*
DEB_EE(("file:%p, cmd:%d, arg:%li\n", file, cmd, arg));
*/
return video_usercopy(file, cmd, arg, saa7146_video_do_ioctl);
}

static int fops_mmap(struct file *file, struct vm_area_struct * vma)
{
struct saa7146_fh *fh = file->private_data;
Expand Down Expand Up @@ -425,7 +417,7 @@ static const struct v4l2_file_operations video_fops =
.write = fops_write,
.poll = fops_poll,
.mmap = fops_mmap,
.ioctl = fops_ioctl,
.ioctl = video_ioctl2,
};

static void vv_callback(struct saa7146_dev *dev, unsigned long status)
Expand All @@ -452,19 +444,16 @@ static void vv_callback(struct saa7146_dev *dev, unsigned long status)
}
}

static struct video_device device_template =
{
.fops = &video_fops,
.minor = -1,
};

int saa7146_vv_init(struct saa7146_dev* dev, struct saa7146_ext_vv *ext_vv)
{
struct saa7146_vv *vv = kzalloc (sizeof(struct saa7146_vv),GFP_KERNEL);
if( NULL == vv ) {
struct saa7146_vv *vv = kzalloc(sizeof(struct saa7146_vv), GFP_KERNEL);

if (vv == NULL) {
ERR(("out of memory. aborting.\n"));
return -1;
}
ext_vv->ops = saa7146_video_ioctl_ops;
ext_vv->core_ops = &saa7146_video_ioctl_ops;

DEB_EE(("dev:%p\n",dev));

Expand Down Expand Up @@ -521,6 +510,7 @@ int saa7146_register_device(struct video_device **vid, struct saa7146_dev* dev,
{
struct saa7146_vv *vv = dev->vv_data;
struct video_device *vfd;
int err;

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

Expand All @@ -529,16 +519,18 @@ int saa7146_register_device(struct video_device **vid, struct saa7146_dev* dev,
if (vfd == NULL)
return -ENOMEM;

memcpy(vfd, &device_template, sizeof(struct video_device));
strlcpy(vfd->name, name, sizeof(vfd->name));
vfd->fops = &video_fops;
vfd->ioctl_ops = dev->ext_vv_data ? &dev->ext_vv_data->ops :
&saa7146_video_ioctl_ops;
vfd->release = video_device_release;
strlcpy(vfd->name, name, sizeof(vfd->name));
video_set_drvdata(vfd, dev);

// fixme: -1 should be an insmod parameter *for the extension* (like "video_nr");
if (video_register_device(vfd, type, -1) < 0) {
err = video_register_device(vfd, type, -1);
if (err < 0) {
ERR(("cannot register v4l2 device. skipping.\n"));
video_device_release(vfd);
return -1;
return err;
}

if( VFL_TYPE_GRABBER == type ) {
Expand Down
Loading

0 comments on commit b960074

Please sign in to comment.