aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/media
diff options
context:
space:
mode:
authorEzequiel GarcĂ­a <elezegarcia@gmail.com>2012-02-24 09:24:18 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-05-15 07:59:22 -0400
commit217d55f2ba0511a18f7427c4a0c10ea21c2eb7d0 (patch)
tree4708afb70578cb2e797fc65f931e038890e697e7 /drivers/staging/media
parent751869e6ef489e33c66a254fa004c92e76ef1a43 (diff)
[media] staging: easycap: Push video registration to easycap_register_video()
Signed-off-by: Ezequiel Garcia <elezegarcia@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/staging/media')
-rw-r--r--drivers/staging/media/easycap/easycap_main.c58
1 files changed, 33 insertions, 25 deletions
diff --git a/drivers/staging/media/easycap/easycap_main.c b/drivers/staging/media/easycap/easycap_main.c
index 480164d8698..68af1a2297b 100644
--- a/drivers/staging/media/easycap/easycap_main.c
+++ b/drivers/staging/media/easycap/easycap_main.c
@@ -3291,6 +3291,37 @@ static const struct v4l2_file_operations v4l2_fops = {
3291 .mmap = easycap_mmap, 3291 .mmap = easycap_mmap,
3292}; 3292};
3293 3293
3294static int easycap_register_video(struct easycap *peasycap)
3295{
3296 /*
3297 * FIXME: This is believed to be harmless,
3298 * but may well be unnecessary or wrong.
3299 */
3300 peasycap->video_device.v4l2_dev = NULL;
3301
3302 strcpy(&peasycap->video_device.name[0], "easycapdc60");
3303 peasycap->video_device.fops = &v4l2_fops;
3304 peasycap->video_device.minor = -1;
3305 peasycap->video_device.release = (void *)(&videodev_release);
3306
3307 video_set_drvdata(&(peasycap->video_device), (void *)peasycap);
3308
3309 if (0 != (video_register_device(&(peasycap->video_device),
3310 VFL_TYPE_GRABBER, -1))) {
3311 err("Not able to register with videodev");
3312 videodev_release(&(peasycap->video_device));
3313 return -ENODEV;
3314 }
3315
3316 peasycap->registered_video++;
3317
3318 SAM("registered with videodev: %i=minor\n",
3319 peasycap->video_device.minor);
3320 peasycap->minor = peasycap->video_device.minor;
3321
3322 return 0;
3323}
3324
3294/* 3325/*
3295 * When the device is plugged, this function is called three times, 3326 * When the device is plugged, this function is called three times,
3296 * one for each interface. 3327 * one for each interface.
@@ -3667,32 +3698,9 @@ static int easycap_usb_probe(struct usb_interface *intf,
3667 JOM(4, "registered device instance: %s\n", 3698 JOM(4, "registered device instance: %s\n",
3668 peasycap->v4l2_device.name); 3699 peasycap->v4l2_device.name);
3669 3700
3670 /* 3701 rc = easycap_register_video(peasycap);
3671 * FIXME: This is believed to be harmless, 3702 if (rc < 0)
3672 * but may well be unnecessary or wrong.
3673 */
3674 peasycap->video_device.v4l2_dev = NULL;
3675
3676
3677 strcpy(&peasycap->video_device.name[0], "easycapdc60");
3678 peasycap->video_device.fops = &v4l2_fops;
3679 peasycap->video_device.minor = -1;
3680 peasycap->video_device.release = (void *)(&videodev_release);
3681
3682 video_set_drvdata(&(peasycap->video_device), (void *)peasycap);
3683
3684 if (0 != (video_register_device(&(peasycap->video_device),
3685 VFL_TYPE_GRABBER, -1))) {
3686 err("Not able to register with videodev");
3687 videodev_release(&(peasycap->video_device));
3688 return -ENODEV; 3703 return -ENODEV;
3689 }
3690
3691 peasycap->registered_video++;
3692 SAM("registered with videodev: %i=minor\n",
3693 peasycap->video_device.minor);
3694 peasycap->minor = peasycap->video_device.minor;
3695
3696 break; 3704 break;
3697 } 3705 }
3698 /* 1: Audio control */ 3706 /* 1: Audio control */