aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/common/saa7146_fops.c
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil@xs4all.nl>2009-01-18 17:59:11 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-03-30 11:42:24 -0400
commitb960074fec573fb1b226d9e2686ce51be807cdf1 (patch)
treeda58b7afa37b0ccd1c06948ad6497cb801553335 /drivers/media/common/saa7146_fops.c
parentc9b8b04b267f9a7e472daa06cdf6d4963d503d1f (diff)
V4L/DVB (10271): saa7146: convert to video_ioctl2.
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>
Diffstat (limited to 'drivers/media/common/saa7146_fops.c')
-rw-r--r--drivers/media/common/saa7146_fops.c36
1 files changed, 14 insertions, 22 deletions
diff --git a/drivers/media/common/saa7146_fops.c b/drivers/media/common/saa7146_fops.c
index cf06f4d10ad4..4a27d4eda628 100644
--- a/drivers/media/common/saa7146_fops.c
+++ b/drivers/media/common/saa7146_fops.c
@@ -308,14 +308,6 @@ static int fops_release(struct file *file)
308 return 0; 308 return 0;
309} 309}
310 310
311static long fops_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
312{
313/*
314 DEB_EE(("file:%p, cmd:%d, arg:%li\n", file, cmd, arg));
315*/
316 return video_usercopy(file, cmd, arg, saa7146_video_do_ioctl);
317}
318
319static int fops_mmap(struct file *file, struct vm_area_struct * vma) 311static int fops_mmap(struct file *file, struct vm_area_struct * vma)
320{ 312{
321 struct saa7146_fh *fh = file->private_data; 313 struct saa7146_fh *fh = file->private_data;
@@ -425,7 +417,7 @@ static const struct v4l2_file_operations video_fops =
425 .write = fops_write, 417 .write = fops_write,
426 .poll = fops_poll, 418 .poll = fops_poll,
427 .mmap = fops_mmap, 419 .mmap = fops_mmap,
428 .ioctl = fops_ioctl, 420 .ioctl = video_ioctl2,
429}; 421};
430 422
431static void vv_callback(struct saa7146_dev *dev, unsigned long status) 423static void vv_callback(struct saa7146_dev *dev, unsigned long status)
@@ -452,19 +444,16 @@ static void vv_callback(struct saa7146_dev *dev, unsigned long status)
452 } 444 }
453} 445}
454 446
455static struct video_device device_template =
456{
457 .fops = &video_fops,
458 .minor = -1,
459};
460
461int saa7146_vv_init(struct saa7146_dev* dev, struct saa7146_ext_vv *ext_vv) 447int saa7146_vv_init(struct saa7146_dev* dev, struct saa7146_ext_vv *ext_vv)
462{ 448{
463 struct saa7146_vv *vv = kzalloc (sizeof(struct saa7146_vv),GFP_KERNEL); 449 struct saa7146_vv *vv = kzalloc(sizeof(struct saa7146_vv), GFP_KERNEL);
464 if( NULL == vv ) { 450
451 if (vv == NULL) {
465 ERR(("out of memory. aborting.\n")); 452 ERR(("out of memory. aborting.\n"));
466 return -1; 453 return -1;
467 } 454 }
455 ext_vv->ops = saa7146_video_ioctl_ops;
456 ext_vv->core_ops = &saa7146_video_ioctl_ops;
468 457
469 DEB_EE(("dev:%p\n",dev)); 458 DEB_EE(("dev:%p\n",dev));
470 459
@@ -521,6 +510,7 @@ int saa7146_register_device(struct video_device **vid, struct saa7146_dev* dev,
521{ 510{
522 struct saa7146_vv *vv = dev->vv_data; 511 struct saa7146_vv *vv = dev->vv_data;
523 struct video_device *vfd; 512 struct video_device *vfd;
513 int err;
524 514
525 DEB_EE(("dev:%p, name:'%s', type:%d\n",dev,name,type)); 515 DEB_EE(("dev:%p, name:'%s', type:%d\n",dev,name,type));
526 516
@@ -529,16 +519,18 @@ int saa7146_register_device(struct video_device **vid, struct saa7146_dev* dev,
529 if (vfd == NULL) 519 if (vfd == NULL)
530 return -ENOMEM; 520 return -ENOMEM;
531 521
532 memcpy(vfd, &device_template, sizeof(struct video_device)); 522 vfd->fops = &video_fops;
533 strlcpy(vfd->name, name, sizeof(vfd->name)); 523 vfd->ioctl_ops = dev->ext_vv_data ? &dev->ext_vv_data->ops :
524 &saa7146_video_ioctl_ops;
534 vfd->release = video_device_release; 525 vfd->release = video_device_release;
526 strlcpy(vfd->name, name, sizeof(vfd->name));
535 video_set_drvdata(vfd, dev); 527 video_set_drvdata(vfd, dev);
536 528
537 // fixme: -1 should be an insmod parameter *for the extension* (like "video_nr"); 529 err = video_register_device(vfd, type, -1);
538 if (video_register_device(vfd, type, -1) < 0) { 530 if (err < 0) {
539 ERR(("cannot register v4l2 device. skipping.\n")); 531 ERR(("cannot register v4l2 device. skipping.\n"));
540 video_device_release(vfd); 532 video_device_release(vfd);
541 return -1; 533 return err;
542 } 534 }
543 535
544 if( VFL_TYPE_GRABBER == type ) { 536 if( VFL_TYPE_GRABBER == type ) {