aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/media/easycap
diff options
context:
space:
mode:
authorEzequiel GarcĂ­a <elezegarcia@gmail.com>2012-02-22 16:46:14 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-03-08 09:32:43 -0500
commit2bc1e212b3f1f783cae9adc5d16aa1a899dc2f82 (patch)
treea2882feee4aa80a953ac3ce17c7f214276925fb1 /drivers/staging/media/easycap
parent9d1760059f29f91ad24cb2dcf75ed2b3f5198dcb (diff)
[media] staging: easycap: Clean comment style in easycap_usb_probe()
Some of these comments may still need to be reviewed. This patch only cleans the comment style. Signed-off-by: Ezequiel Garcia <elezegarcia@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/staging/media/easycap')
-rw-r--r--drivers/staging/media/easycap/easycap_main.c243
1 files changed, 79 insertions, 164 deletions
diff --git a/drivers/staging/media/easycap/easycap_main.c b/drivers/staging/media/easycap/easycap_main.c
index 3d439b790cc..95f3cc1867d 100644
--- a/drivers/staging/media/easycap/easycap_main.c
+++ b/drivers/staging/media/easycap/easycap_main.c
@@ -2849,13 +2849,11 @@ static const struct v4l2_file_operations v4l2_fops = {
2849 .poll = easycap_poll, 2849 .poll = easycap_poll,
2850 .mmap = easycap_mmap, 2850 .mmap = easycap_mmap,
2851}; 2851};
2852/*****************************************************************************/ 2852
2853/*---------------------------------------------------------------------------*/
2854/* 2853/*
2855 * WHEN THE EasyCAP IS PHYSICALLY PLUGGED IN, THIS FUNCTION IS CALLED THREE 2854 * When the device is plugged, this function is called three times,
2856 * TIMES, ONCE FOR EACH OF THE THREE INTERFACES. BEWARE. 2855 * one for each interface.
2857 */ 2856 */
2858/*---------------------------------------------------------------------------*/
2859static int easycap_usb_probe(struct usb_interface *intf, 2857static int easycap_usb_probe(struct usb_interface *intf,
2860 const struct usb_device_id *id) 2858 const struct usb_device_id *id)
2861{ 2859{
@@ -2884,7 +2882,6 @@ static int easycap_usb_probe(struct usb_interface *intf,
2884 2882
2885 usbdev = interface_to_usbdev(intf); 2883 usbdev = interface_to_usbdev(intf);
2886 2884
2887/*---------------------------------------------------------------------------*/
2888 alt = usb_altnum_to_altsetting(intf, 0); 2885 alt = usb_altnum_to_altsetting(intf, 0);
2889 if (!alt) { 2886 if (!alt) {
2890 SAY("ERROR: usb_host_interface not found\n"); 2887 SAY("ERROR: usb_host_interface not found\n");
@@ -2896,11 +2893,8 @@ static int easycap_usb_probe(struct usb_interface *intf,
2896 SAY("ERROR: intf_descriptor is NULL\n"); 2893 SAY("ERROR: intf_descriptor is NULL\n");
2897 return -EFAULT; 2894 return -EFAULT;
2898 } 2895 }
2899/*---------------------------------------------------------------------------*/ 2896
2900/* 2897 /* Get properties of probed interface */
2901 * GET PROPERTIES OF PROBED INTERFACE
2902 */
2903/*---------------------------------------------------------------------------*/
2904 bInterfaceNumber = interface->bInterfaceNumber; 2898 bInterfaceNumber = interface->bInterfaceNumber;
2905 bInterfaceClass = interface->bInterfaceClass; 2899 bInterfaceClass = interface->bInterfaceClass;
2906 bInterfaceSubClass = interface->bInterfaceSubClass; 2900 bInterfaceSubClass = interface->bInterfaceSubClass;
@@ -2912,28 +2906,23 @@ static int easycap_usb_probe(struct usb_interface *intf,
2912 (long int)(intf->cur_altsetting - intf->altsetting)); 2906 (long int)(intf->cur_altsetting - intf->altsetting));
2913 JOT(4, "intf[%i]: bInterfaceClass=0x%02X bInterfaceSubClass=0x%02X\n", 2907 JOT(4, "intf[%i]: bInterfaceClass=0x%02X bInterfaceSubClass=0x%02X\n",
2914 bInterfaceNumber, bInterfaceClass, bInterfaceSubClass); 2908 bInterfaceNumber, bInterfaceClass, bInterfaceSubClass);
2915/*---------------------------------------------------------------------------*/ 2909
2916/* 2910 /*
2917 * A NEW struct easycap IS ALWAYS ALLOCATED WHEN INTERFACE 0 IS PROBED. 2911 * A new struct easycap is always allocated when interface 0 is probed.
2918 * IT IS NOT POSSIBLE HERE TO FREE ANY EXISTING struct easycap. THIS 2912 * It is not possible here to free any existing struct easycap.
2919 * SHOULD HAVE BEEN DONE BY easycap_delete() WHEN THE EasyCAP WAS 2913 * This should have been done by easycap_delete() when the device was
2920 * PHYSICALLY UNPLUGGED. 2914 * physically unplugged.
2921 * 2915 * The allocated struct easycap is saved for later usage when
2922 * THE POINTER peasycap TO THE struct easycap IS REMEMBERED WHEN 2916 * interfaces 1 and 2 are probed.
2923 * INTERFACES 1 AND 2 ARE PROBED. 2917 */
2924*/
2925/*---------------------------------------------------------------------------*/
2926 if (0 == bInterfaceNumber) { 2918 if (0 == bInterfaceNumber) {
2927 peasycap = kzalloc(sizeof(struct easycap), GFP_KERNEL); 2919 peasycap = kzalloc(sizeof(struct easycap), GFP_KERNEL);
2928 if (!peasycap) { 2920 if (!peasycap) {
2929 SAY("ERROR: Could not allocate peasycap\n"); 2921 SAY("ERROR: Could not allocate peasycap\n");
2930 return -ENOMEM; 2922 return -ENOMEM;
2931 } 2923 }
2932/*---------------------------------------------------------------------------*/ 2924
2933/* 2925 /* Perform urgent initializations */
2934 * PERFORM URGENT INTIALIZATIONS ...
2935*/
2936/*---------------------------------------------------------------------------*/
2937 peasycap->minor = -1; 2926 peasycap->minor = -1;
2938 kref_init(&peasycap->kref); 2927 kref_init(&peasycap->kref);
2939 JOM(8, "intf[%i]: after kref_init(..._video) " 2928 JOM(8, "intf[%i]: after kref_init(..._video) "
@@ -2976,11 +2965,7 @@ static int easycap_usb_probe(struct usb_interface *intf,
2976 2965
2977 peasycap->allocation_video_struct = sizeof(struct easycap); 2966 peasycap->allocation_video_struct = sizeof(struct easycap);
2978 2967
2979/*---------------------------------------------------------------------------*/ 2968 /* and further initialize the structure */
2980/*
2981 * ... AND FURTHER INITIALIZE THE STRUCTURE
2982*/
2983/*---------------------------------------------------------------------------*/
2984 peasycap->pusb_device = usbdev; 2969 peasycap->pusb_device = usbdev;
2985 peasycap->pusb_interface = intf; 2970 peasycap->pusb_interface = intf;
2986 2971
@@ -3002,11 +2987,7 @@ static int easycap_usb_probe(struct usb_interface *intf,
3002 2987
3003 peasycap->frame_buffer_many = FRAME_BUFFER_MANY; 2988 peasycap->frame_buffer_many = FRAME_BUFFER_MANY;
3004 2989
3005/*---------------------------------------------------------------------------*/ 2990 /* Dynamically fill in the available formats */
3006/*
3007 * DYNAMICALLY FILL IN THE AVAILABLE FORMATS ...
3008 */
3009/*---------------------------------------------------------------------------*/
3010 rc = easycap_video_fillin_formats(); 2991 rc = easycap_video_fillin_formats();
3011 if (0 > rc) { 2992 if (0 > rc) {
3012 SAM("ERROR: fillin_formats() rc = %i\n", rc); 2993 SAM("ERROR: fillin_formats() rc = %i\n", rc);
@@ -3014,10 +2995,8 @@ static int easycap_usb_probe(struct usb_interface *intf,
3014 } 2995 }
3015 JOM(4, "%i formats available\n", rc); 2996 JOM(4, "%i formats available\n", rc);
3016 2997
3017 /* ... AND POPULATE easycap.inputset[] */ 2998 /* Populate easycap.inputset[] */
3018
3019 inputset = peasycap->inputset; 2999 inputset = peasycap->inputset;
3020
3021 fmtidx = peasycap->ntsc ? NTSC_M : PAL_BGHIN; 3000 fmtidx = peasycap->ntsc ? NTSC_M : PAL_BGHIN;
3022 m = 0; 3001 m = 0;
3023 mask = 0; 3002 mask = 0;
@@ -3030,7 +3009,6 @@ static int easycap_usb_probe(struct usb_interface *intf,
3030 mask = easycap_standard[i].mask; 3009 mask = easycap_standard[i].mask;
3031 } 3010 }
3032 } 3011 }
3033
3034 if (1 != m) { 3012 if (1 != m) {
3035 SAM("ERROR: " 3013 SAM("ERROR: "
3036 "inputset->standard_offset unpopulated, %i=m\n", m); 3014 "inputset->standard_offset unpopulated, %i=m\n", m);
@@ -3089,14 +3067,13 @@ static int easycap_usb_probe(struct usb_interface *intf,
3089 JOM(4, "populated inputset[]\n"); 3067 JOM(4, "populated inputset[]\n");
3090 JOM(4, "finished initialization\n"); 3068 JOM(4, "finished initialization\n");
3091 } else { 3069 } else {
3092/*---------------------------------------------------------------------------*/ 3070
3093/* 3071 /*
3094 * FIXME 3072 * FIXME: Identify the appropriate pointer
3095 * 3073 * peasycap for interfaces 1 and 2.
3096 * IDENTIFY THE APPROPRIATE POINTER peasycap FOR INTERFACES 1 AND 2. 3074 * The address of peasycap->pusb_device
3097 * THE ADDRESS OF peasycap->pusb_device IS RELUCTANTLY USED FOR THIS PURPOSE. 3075 * is reluctantly used for this purpose.
3098 */ 3076 */
3099/*---------------------------------------------------------------------------*/
3100 for (ndong = 0; ndong < DONGLE_MANY; ndong++) { 3077 for (ndong = 0; ndong < DONGLE_MANY; ndong++) {
3101 if (usbdev == easycapdc60_dongle[ndong].peasycap-> 3078 if (usbdev == easycapdc60_dongle[ndong].peasycap->
3102 pusb_device) { 3079 pusb_device) {
@@ -3117,7 +3094,7 @@ static int easycap_usb_probe(struct usb_interface *intf,
3117 return -ENODEV; 3094 return -ENODEV;
3118 } 3095 }
3119 } 3096 }
3120/*---------------------------------------------------------------------------*/ 3097
3121 if ((USB_CLASS_VIDEO == bInterfaceClass) || 3098 if ((USB_CLASS_VIDEO == bInterfaceClass) ||
3122 (USB_CLASS_VENDOR_SPEC == bInterfaceClass)) { 3099 (USB_CLASS_VENDOR_SPEC == bInterfaceClass)) {
3123 if (-1 == peasycap->video_interface) { 3100 if (-1 == peasycap->video_interface) {
@@ -3149,14 +3126,12 @@ static int easycap_usb_probe(struct usb_interface *intf,
3149 } 3126 }
3150 } 3127 }
3151 } 3128 }
3152/*---------------------------------------------------------------------------*/
3153/*
3154 * INVESTIGATE ALL ALTSETTINGS.
3155 * DONE IN DETAIL BECAUSE USB DEVICE 05e1:0408 HAS DISPARATE INCARNATIONS.
3156 */
3157/*---------------------------------------------------------------------------*/
3158 isokalt = 0;
3159 3129
3130 /*
3131 * Investigate all altsettings. This is done in detail
3132 * because USB device 05e1:0408 has disparate incarnations.
3133 */
3134 isokalt = 0;
3160 for (i = 0; i < intf->num_altsetting; i++) { 3135 for (i = 0; i < intf->num_altsetting; i++) {
3161 alt = usb_altnum_to_altsetting(intf, i); 3136 alt = usb_altnum_to_altsetting(intf, i);
3162 if (!alt) { 3137 if (!alt) {
@@ -3172,7 +3147,6 @@ static int easycap_usb_probe(struct usb_interface *intf,
3172 if (0 == interface->bNumEndpoints) 3147 if (0 == interface->bNumEndpoints)
3173 JOM(4, "intf[%i]alt[%i] has no endpoints\n", 3148 JOM(4, "intf[%i]alt[%i] has no endpoints\n",
3174 bInterfaceNumber, i); 3149 bInterfaceNumber, i);
3175/*---------------------------------------------------------------------------*/
3176 for (j = 0; j < interface->bNumEndpoints; j++) { 3150 for (j = 0; j < interface->bNumEndpoints; j++) {
3177 ep = &alt->endpoint[j].desc; 3151 ep = &alt->endpoint[j].desc;
3178 if (!ep) { 3152 if (!ep) {
@@ -3312,19 +3286,12 @@ static int easycap_usb_probe(struct usb_interface *intf,
3312 } 3286 }
3313 } 3287 }
3314 } 3288 }
3315/*---------------------------------------------------------------------------*/ 3289
3316/* 3290 /* Perform initialization of the probed interface */
3317 * PERFORM INITIALIZATION OF THE PROBED INTERFACE
3318 */
3319/*---------------------------------------------------------------------------*/
3320 JOM(4, "initialization begins for interface %i\n", 3291 JOM(4, "initialization begins for interface %i\n",
3321 interface->bInterfaceNumber); 3292 interface->bInterfaceNumber);
3322 switch (bInterfaceNumber) { 3293 switch (bInterfaceNumber) {
3323/*---------------------------------------------------------------------------*/ 3294 /* 0: Video interface */
3324/*
3325 * INTERFACE 0 IS THE VIDEO INTERFACE
3326 */
3327/*---------------------------------------------------------------------------*/
3328 case 0: { 3295 case 0: {
3329 if (!peasycap) { 3296 if (!peasycap) {
3330 SAM("MISTAKE: peasycap is NULL\n"); 3297 SAM("MISTAKE: peasycap is NULL\n");
@@ -3337,11 +3304,8 @@ static int easycap_usb_probe(struct usb_interface *intf,
3337 peasycap->video_altsetting_on = okalt[isokalt - 1]; 3304 peasycap->video_altsetting_on = okalt[isokalt - 1];
3338 JOM(4, "%i=video_altsetting_on <====\n", 3305 JOM(4, "%i=video_altsetting_on <====\n",
3339 peasycap->video_altsetting_on); 3306 peasycap->video_altsetting_on);
3340/*---------------------------------------------------------------------------*/ 3307
3341/* 3308 /* Decide video streaming parameters */
3342 * DECIDE THE VIDEO STREAMING PARAMETERS
3343 */
3344/*---------------------------------------------------------------------------*/
3345 peasycap->video_endpointnumber = okepn[isokalt - 1]; 3309 peasycap->video_endpointnumber = okepn[isokalt - 1];
3346 JOM(4, "%i=video_endpointnumber\n", peasycap->video_endpointnumber); 3310 JOM(4, "%i=video_endpointnumber\n", peasycap->video_endpointnumber);
3347 maxpacketsize = okmps[isokalt - 1]; 3311 maxpacketsize = okmps[isokalt - 1];
@@ -3373,7 +3337,6 @@ static int easycap_usb_probe(struct usb_interface *intf,
3373 SAM("MISTAKE: peasycap->video_isoc_buffer_size too big\n"); 3337 SAM("MISTAKE: peasycap->video_isoc_buffer_size too big\n");
3374 return -EFAULT; 3338 return -EFAULT;
3375 } 3339 }
3376/*---------------------------------------------------------------------------*/
3377 if (-1 == peasycap->video_interface) { 3340 if (-1 == peasycap->video_interface) {
3378 SAM("MISTAKE: video_interface is unset\n"); 3341 SAM("MISTAKE: video_interface is unset\n");
3379 return -EFAULT; 3342 return -EFAULT;
@@ -3398,14 +3361,13 @@ static int easycap_usb_probe(struct usb_interface *intf,
3398 SAM("MISTAKE: video_isoc_buffer_size is unset\n"); 3361 SAM("MISTAKE: video_isoc_buffer_size is unset\n");
3399 return -EFAULT; 3362 return -EFAULT;
3400 } 3363 }
3401/*---------------------------------------------------------------------------*/ 3364
3402/* 3365 /*
3403 * ALLOCATE MEMORY FOR VIDEO BUFFERS. LISTS MUST BE INITIALIZED FIRST. 3366 * Allocate memory for video buffers.
3404 */ 3367 * Lists must be initialized first.
3405/*---------------------------------------------------------------------------*/ 3368 */
3406 INIT_LIST_HEAD(&(peasycap->urb_video_head)); 3369 INIT_LIST_HEAD(&(peasycap->urb_video_head));
3407 peasycap->purb_video_head = &(peasycap->urb_video_head); 3370 peasycap->purb_video_head = &(peasycap->urb_video_head);
3408/*---------------------------------------------------------------------------*/
3409 JOM(4, "allocating %i frame buffers of size %li\n", 3371 JOM(4, "allocating %i frame buffers of size %li\n",
3410 FRAME_BUFFER_MANY, (long int)FRAME_BUFFER_SIZE); 3372 FRAME_BUFFER_MANY, (long int)FRAME_BUFFER_SIZE);
3411 JOM(4, ".... each scattered over %li pages\n", 3373 JOM(4, ".... each scattered over %li pages\n",
@@ -3436,7 +3398,6 @@ static int easycap_usb_probe(struct usb_interface *intf,
3436 peasycap->frame_read = 0; 3398 peasycap->frame_read = 0;
3437 JOM(4, "allocation of frame buffers done: %i pages\n", k * 3399 JOM(4, "allocation of frame buffers done: %i pages\n", k *
3438 m); 3400 m);
3439/*---------------------------------------------------------------------------*/
3440 JOM(4, "allocating %i field buffers of size %li\n", 3401 JOM(4, "allocating %i field buffers of size %li\n",
3441 FIELD_BUFFER_MANY, (long int)FIELD_BUFFER_SIZE); 3402 FIELD_BUFFER_MANY, (long int)FIELD_BUFFER_SIZE);
3442 JOM(4, ".... each scattered over %li pages\n", 3403 JOM(4, ".... each scattered over %li pages\n",
@@ -3468,7 +3429,6 @@ static int easycap_usb_probe(struct usb_interface *intf,
3468 peasycap->field_read = 0; 3429 peasycap->field_read = 0;
3469 JOM(4, "allocation of field buffers done: %i pages\n", k * 3430 JOM(4, "allocation of field buffers done: %i pages\n", k *
3470 m); 3431 m);
3471/*---------------------------------------------------------------------------*/
3472 JOM(4, "allocating %i isoc video buffers of size %i\n", 3432 JOM(4, "allocating %i isoc video buffers of size %i\n",
3473 VIDEO_ISOC_BUFFER_MANY, 3433 VIDEO_ISOC_BUFFER_MANY,
3474 peasycap->video_isoc_buffer_size); 3434 peasycap->video_isoc_buffer_size);
@@ -3492,11 +3452,8 @@ static int easycap_usb_probe(struct usb_interface *intf,
3492 } 3452 }
3493 JOM(4, "allocation of isoc video buffers done: %i pages\n", 3453 JOM(4, "allocation of isoc video buffers done: %i pages\n",
3494 k * (0x01 << VIDEO_ISOC_ORDER)); 3454 k * (0x01 << VIDEO_ISOC_ORDER));
3495/*---------------------------------------------------------------------------*/ 3455
3496/* 3456 /* Allocate and initialize multiple struct usb */
3497 * ALLOCATE AND INITIALIZE MULTIPLE struct urb ...
3498 */
3499/*---------------------------------------------------------------------------*/
3500 JOM(4, "allocating %i struct urb.\n", VIDEO_ISOC_BUFFER_MANY); 3457 JOM(4, "allocating %i struct urb.\n", VIDEO_ISOC_BUFFER_MANY);
3501 JOM(4, "using %i=peasycap->video_isoc_framesperdesc\n", 3458 JOM(4, "using %i=peasycap->video_isoc_framesperdesc\n",
3502 peasycap->video_isoc_framesperdesc); 3459 peasycap->video_isoc_framesperdesc);
@@ -3515,7 +3472,6 @@ static int easycap_usb_probe(struct usb_interface *intf,
3515 } 3472 }
3516 3473
3517 peasycap->allocation_video_urb += 1; 3474 peasycap->allocation_video_urb += 1;
3518/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
3519 pdata_urb = kzalloc(sizeof(struct data_urb), GFP_KERNEL); 3475 pdata_urb = kzalloc(sizeof(struct data_urb), GFP_KERNEL);
3520 if (!pdata_urb) { 3476 if (!pdata_urb) {
3521 SAM("ERROR: Could not allocate struct data_urb.\n"); 3477 SAM("ERROR: Could not allocate struct data_urb.\n");
@@ -3530,11 +3486,8 @@ static int easycap_usb_probe(struct usb_interface *intf,
3530 pdata_urb->length = 0; 3486 pdata_urb->length = 0;
3531 list_add_tail(&(pdata_urb->list_head), 3487 list_add_tail(&(pdata_urb->list_head),
3532 peasycap->purb_video_head); 3488 peasycap->purb_video_head);
3533/*---------------------------------------------------------------------------*/ 3489
3534/* 3490 /* Initialize allocated urbs */
3535 * ... AND INITIALIZE THEM
3536 */
3537/*---------------------------------------------------------------------------*/
3538 if (!k) { 3491 if (!k) {
3539 JOM(4, "initializing video urbs thus:\n"); 3492 JOM(4, "initializing video urbs thus:\n");
3540 JOM(4, " purb->interval = 1;\n"); 3493 JOM(4, " purb->interval = 1;\n");
@@ -3582,20 +3535,17 @@ static int easycap_usb_probe(struct usb_interface *intf,
3582 } 3535 }
3583 } 3536 }
3584 JOM(4, "allocation of %i struct urb done.\n", k); 3537 JOM(4, "allocation of %i struct urb done.\n", k);
3585/*--------------------------------------------------------------------------*/ 3538
3586/* 3539 /* Save pointer peasycap in this interface */
3587 * SAVE POINTER peasycap IN THIS INTERFACE.
3588 */
3589/*--------------------------------------------------------------------------*/
3590 usb_set_intfdata(intf, peasycap); 3540 usb_set_intfdata(intf, peasycap);
3591/*---------------------------------------------------------------------------*/ 3541
3592/* 3542 /*
3593 * IT IS ESSENTIAL TO INITIALIZE THE HARDWARE BEFORE, RATHER THAN AFTER, 3543 * It is essential to initialize the hardware before,
3594 * THE DEVICE IS REGISTERED, BECAUSE SOME VERSIONS OF THE videodev MODULE 3544 * rather than after, the device is registered,
3595 * CALL easycap_open() IMMEDIATELY AFTER REGISTRATION, CAUSING A CLASH. 3545 * because some versions of the videodev module
3596 * BEWARE. 3546 * call easycap_open() immediately after registration,
3597*/ 3547 * causing a clash.
3598/*---------------------------------------------------------------------------*/ 3548 */
3599 peasycap->ntsc = easycap_ntsc; 3549 peasycap->ntsc = easycap_ntsc;
3600 JOM(8, "defaulting initially to %s\n", 3550 JOM(8, "defaulting initially to %s\n",
3601 easycap_ntsc ? "NTSC" : "PAL"); 3551 easycap_ntsc ? "NTSC" : "PAL");
@@ -3604,27 +3554,20 @@ static int easycap_usb_probe(struct usb_interface *intf,
3604 SAM("ERROR: reset() rc = %i\n", rc); 3554 SAM("ERROR: reset() rc = %i\n", rc);
3605 return -EFAULT; 3555 return -EFAULT;
3606 } 3556 }
3607/*--------------------------------------------------------------------------*/ 3557
3608/* 3558 /* The video device can now be registered */
3609 * THE VIDEO DEVICE CAN BE REGISTERED NOW, AS IT IS READY.
3610 */
3611/*--------------------------------------------------------------------------*/
3612 if (v4l2_device_register(&intf->dev, &peasycap->v4l2_device)) { 3559 if (v4l2_device_register(&intf->dev, &peasycap->v4l2_device)) {
3613 SAM("v4l2_device_register() failed\n"); 3560 SAM("v4l2_device_register() failed\n");
3614 return -ENODEV; 3561 return -ENODEV;
3615 } 3562 }
3616 JOM(4, "registered device instance: %s\n", 3563 JOM(4, "registered device instance: %s\n",
3617 peasycap->v4l2_device.name); 3564 peasycap->v4l2_device.name);
3618/*---------------------------------------------------------------------------*/ 3565
3619/* 3566 /*
3620 * FIXME 3567 * FIXME: This is believed to be harmless,
3621 * 3568 * but may well be unnecessary or wrong.
3622 * 3569 */
3623 * THIS IS BELIEVED TO BE HARMLESS, BUT MAY WELL BE UNNECESSARY OR WRONG:
3624*/
3625/*---------------------------------------------------------------------------*/
3626 peasycap->video_device.v4l2_dev = NULL; 3570 peasycap->video_device.v4l2_dev = NULL;
3627/*---------------------------------------------------------------------------*/
3628 3571
3629 3572
3630 strcpy(&peasycap->video_device.name[0], "easycapdc60"); 3573 strcpy(&peasycap->video_device.name[0], "easycapdc60");
@@ -3648,28 +3591,19 @@ static int easycap_usb_probe(struct usb_interface *intf,
3648 3591
3649 break; 3592 break;
3650 } 3593 }
3651/*--------------------------------------------------------------------------*/ 3594 /* 1: Audio control */
3652/*
3653 * INTERFACE 1 IS THE AUDIO CONTROL INTERFACE
3654 * INTERFACE 2 IS THE AUDIO STREAMING INTERFACE
3655 */
3656/*--------------------------------------------------------------------------*/
3657 case 1: { 3595 case 1: {
3658 if (!peasycap) { 3596 if (!peasycap) {
3659 SAM("MISTAKE: peasycap is NULL\n"); 3597 SAM("MISTAKE: peasycap is NULL\n");
3660 return -EFAULT; 3598 return -EFAULT;
3661 } 3599 }
3662/*--------------------------------------------------------------------------*/ 3600 /* Save pointer peasycap in this interface */
3663/*
3664 * SAVE POINTER peasycap IN INTERFACE 1
3665 */
3666/*--------------------------------------------------------------------------*/
3667 usb_set_intfdata(intf, peasycap); 3601 usb_set_intfdata(intf, peasycap);
3668 JOM(4, "no initialization required for interface %i\n", 3602 JOM(4, "no initialization required for interface %i\n",
3669 interface->bInterfaceNumber); 3603 interface->bInterfaceNumber);
3670 break; 3604 break;
3671 } 3605 }
3672/*--------------------------------------------------------------------------*/ 3606 /* 2: Audio streaming */
3673 case 2: { 3607 case 2: {
3674 if (!peasycap) { 3608 if (!peasycap) {
3675 SAM("MISTAKE: peasycap is NULL\n"); 3609 SAM("MISTAKE: peasycap is NULL\n");
@@ -3769,15 +3703,14 @@ static int easycap_usb_probe(struct usb_interface *intf,
3769 SAM("MISTAKE: audio_isoc_buffer_size is unset\n"); 3703 SAM("MISTAKE: audio_isoc_buffer_size is unset\n");
3770 return -EFAULT; 3704 return -EFAULT;
3771 } 3705 }
3772/*---------------------------------------------------------------------------*/ 3706
3773/* 3707 /*
3774 * ALLOCATE MEMORY FOR AUDIO BUFFERS. LISTS MUST BE INITIALIZED FIRST. 3708 * Allocate memory for audio buffers.
3775 */ 3709 * Lists must be initialized first.
3776/*---------------------------------------------------------------------------*/ 3710 */
3777 INIT_LIST_HEAD(&(peasycap->urb_audio_head)); 3711 INIT_LIST_HEAD(&(peasycap->urb_audio_head));
3778 peasycap->purb_audio_head = &(peasycap->urb_audio_head); 3712 peasycap->purb_audio_head = &(peasycap->urb_audio_head);
3779 3713
3780/*---------------------------------------------------------------------------*/
3781 JOM(4, "allocating %i isoc audio buffers of size %i\n", 3714 JOM(4, "allocating %i isoc audio buffers of size %i\n",
3782 AUDIO_ISOC_BUFFER_MANY, 3715 AUDIO_ISOC_BUFFER_MANY,
3783 peasycap->audio_isoc_buffer_size); 3716 peasycap->audio_isoc_buffer_size);
@@ -3800,11 +3733,8 @@ static int easycap_usb_probe(struct usb_interface *intf,
3800 peasycap->audio_isoc_buffer[k].kount = k; 3733 peasycap->audio_isoc_buffer[k].kount = k;
3801 } 3734 }
3802 JOM(4, "allocation of isoc audio buffers done.\n"); 3735 JOM(4, "allocation of isoc audio buffers done.\n");
3803/*---------------------------------------------------------------------------*/ 3736
3804/* 3737 /* Allocate and initialize urbs */
3805 * ALLOCATE AND INITIALIZE MULTIPLE struct urb ...
3806 */
3807/*---------------------------------------------------------------------------*/
3808 JOM(4, "allocating %i struct urb.\n", AUDIO_ISOC_BUFFER_MANY); 3738 JOM(4, "allocating %i struct urb.\n", AUDIO_ISOC_BUFFER_MANY);
3809 JOM(4, "using %i=peasycap->audio_isoc_framesperdesc\n", 3739 JOM(4, "using %i=peasycap->audio_isoc_framesperdesc\n",
3810 peasycap->audio_isoc_framesperdesc); 3740 peasycap->audio_isoc_framesperdesc);
@@ -3822,7 +3752,6 @@ static int easycap_usb_probe(struct usb_interface *intf,
3822 return -ENOMEM; 3752 return -ENOMEM;
3823 } 3753 }
3824 peasycap->allocation_audio_urb += 1 ; 3754 peasycap->allocation_audio_urb += 1 ;
3825/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
3826 pdata_urb = kzalloc(sizeof(struct data_urb), GFP_KERNEL); 3755 pdata_urb = kzalloc(sizeof(struct data_urb), GFP_KERNEL);
3827 if (!pdata_urb) { 3756 if (!pdata_urb) {
3828 usb_free_urb(purb); 3757 usb_free_urb(purb);
@@ -3837,11 +3766,7 @@ static int easycap_usb_probe(struct usb_interface *intf,
3837 pdata_urb->length = 0; 3766 pdata_urb->length = 0;
3838 list_add_tail(&(pdata_urb->list_head), 3767 list_add_tail(&(pdata_urb->list_head),
3839 peasycap->purb_audio_head); 3768 peasycap->purb_audio_head);
3840/*---------------------------------------------------------------------------*/ 3769
3841/*
3842 * ... AND INITIALIZE THEM
3843 */
3844/*---------------------------------------------------------------------------*/
3845 if (!k) { 3770 if (!k) {
3846 JOM(4, "initializing audio urbs thus:\n"); 3771 JOM(4, "initializing audio urbs thus:\n");
3847 JOM(4, " purb->interval = 1;\n"); 3772 JOM(4, " purb->interval = 1;\n");
@@ -3889,17 +3814,11 @@ static int easycap_usb_probe(struct usb_interface *intf,
3889 } 3814 }
3890 } 3815 }
3891 JOM(4, "allocation of %i struct urb done.\n", k); 3816 JOM(4, "allocation of %i struct urb done.\n", k);
3892/*---------------------------------------------------------------------------*/ 3817
3893/* 3818 /* Save pointer peasycap in this interface */
3894 * SAVE POINTER peasycap IN THIS INTERFACE.
3895 */
3896/*---------------------------------------------------------------------------*/
3897 usb_set_intfdata(intf, peasycap); 3819 usb_set_intfdata(intf, peasycap);
3898/*---------------------------------------------------------------------------*/ 3820
3899/* 3821 /* The audio device can now be registered */
3900 * THE AUDIO DEVICE CAN BE REGISTERED NOW, AS IT IS READY.
3901 */
3902/*---------------------------------------------------------------------------*/
3903 JOM(4, "initializing ALSA card\n"); 3822 JOM(4, "initializing ALSA card\n");
3904 3823
3905 rc = easycap_alsa_probe(peasycap); 3824 rc = easycap_alsa_probe(peasycap);
@@ -3915,11 +3834,7 @@ static int easycap_usb_probe(struct usb_interface *intf,
3915 peasycap->registered_audio++; 3834 peasycap->registered_audio++;
3916 break; 3835 break;
3917 } 3836 }
3918/*---------------------------------------------------------------------------*/ 3837 /* Interfaces other than 0,1,2 are unexpected */
3919/*
3920 * INTERFACES OTHER THAN 0, 1 AND 2 ARE UNEXPECTED
3921 */
3922/*---------------------------------------------------------------------------*/
3923 default: 3838 default:
3924 JOM(4, "ERROR: unexpected interface %i\n", bInterfaceNumber); 3839 JOM(4, "ERROR: unexpected interface %i\n", bInterfaceNumber);
3925 return -EINVAL; 3840 return -EINVAL;