From: Greg KH To: torvalds@transmeta.com Cc: linux-usb-devel@lists.sourceforge.net, ccheney@cheney.cx, pavel@suse.cz Subject: [PATCH 12 of 16] USB vicam driver change Hi, Here's a patch against 2.5.3-pre3 for the USB vicam driver that converts it to dynamically allocate its urbs. thanks, greg k-h diff -Nru a/drivers/usb/vicam.c b/drivers/usb/vicam.c --- a/drivers/usb/vicam.c Tue Jan 22 12:54:24 2002 +++ b/drivers/usb/vicam.c Tue Jan 22 12:54:24 2002 @@ -344,7 +344,7 @@ synchronize(vicam); mdelay(10); vicam_parameters(vicam); - printk("Submiting urb: %d\n", usb_submit_urb(&vicam->readurb)); + printk("Submiting urb: %d\n", usb_submit_urb(vicam->readurb)); #endif } @@ -841,9 +841,9 @@ vicam_parameters(vicam); - FILL_BULK_URB(&vicam->readurb, vicam->udev, usb_rcvbulkpipe(vicam->udev, 0x81), + FILL_BULK_URB(vicam->readurb, vicam->udev, usb_rcvbulkpipe(vicam->udev, 0x81), buf, 0x1e480, vicam_bulk, vicam); - printk("Submiting urb: %d\n", usb_submit_urb(&vicam->readurb)); + printk("Submiting urb: %d\n", usb_submit_urb(vicam->readurb)); return 0; error: @@ -877,7 +877,13 @@ return NULL; } memset(vicam, 0, sizeof(*vicam)); - + + vicam->readurb = usb_alloc_urb(0); + if (!vicam->readurb) { + kfree(vicam); + return NULL; + } + vicam->udev = udev; vicam->camera_name = camera_name; vicam->win.brightness = 128; @@ -925,6 +931,7 @@ if (!vicam->open_count) { /* Other random junk */ + usb_free_urb(vicam->readurb); kfree(vicam); vicam = NULL; } diff -Nru a/drivers/usb/vicam.h b/drivers/usb/vicam.h --- a/drivers/usb/vicam.h Tue Jan 22 12:54:25 2002 +++ b/drivers/usb/vicam.h Tue Jan 22 12:54:25 2002 @@ -75,7 +75,7 @@ int maxframesize; struct picture_parm win; struct proc_dir_entry *proc_entry; /* /proc/se401/videoX */ - struct urb readurb; + struct urb *readurb; }; #endif