patch-2.4.0-test11 linux/drivers/media/video/cpia_usb.c

Next file: linux/drivers/media/video/id.h
Previous file: linux/drivers/media/video/cpia.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.0-test10/linux/drivers/media/video/cpia_usb.c linux/drivers/media/video/cpia_usb.c
@@ -432,11 +432,21 @@
 		ucpia->sbuf[1].urb = NULL;
 	}
 
+	if (ucpia->sbuf[1].data) {
+		kfree(ucpia->sbuf[1].data);
+		ucpia->sbuf[1].data = NULL;
+	}
+ 
 	if (ucpia->sbuf[0].urb) {
 		usb_unlink_urb(ucpia->sbuf[0].urb);
 		usb_free_urb(ucpia->sbuf[0].urb);
 		ucpia->sbuf[0].urb = NULL;
 	}
+
+	if (ucpia->sbuf[0].data) {
+		kfree(ucpia->sbuf[0].data);
+		ucpia->sbuf[0].data = NULL;
+	}
 }
 
 static int cpia_usb_close(void *privdata)
@@ -461,7 +471,8 @@
 
 /* Probing and initializing */
 
-static void *cpia_probe(struct usb_device *udev, unsigned int ifnum)
+static void *cpia_probe(struct usb_device *udev, unsigned int ifnum,
+			const struct usb_device_id *id)
 {
 	struct usb_interface_descriptor *interface;
 	struct usb_cpia *ucpia;
@@ -474,13 +485,6 @@
 
 	interface = &udev->actconfig->interface[ifnum].altsetting[0];
 
-	/* Is it a CPiA? */
-	if (udev->descriptor.idVendor != 0x0553)
-		return NULL;
-	if (udev->descriptor.idProduct != 0x0002)
-		return NULL;
-
-	/* We found a CPiA */
 	printk(KERN_INFO "USB CPiA camera found\n");
 
 	ucpia = kmalloc(sizeof(*ucpia), GFP_KERNEL);
@@ -552,11 +556,18 @@
 
 static void cpia_disconnect(struct usb_device *dev, void *ptr);
 
+static struct usb_device_id cpia_id_table [] = {
+	{ idVendor: 0x0553, idProduct: 0x0002 },
+	{ }					/* Terminating entry */
+};
+
+MODULE_DEVICE_TABLE (usb, cpia_id_table);
+
 static struct usb_driver cpia_driver = {
-	"cpia",
-	cpia_probe,
-	cpia_disconnect,
-	{ NULL, NULL }
+	name:		"cpia",
+	probe:		cpia_probe,
+	disconnect:	cpia_disconnect,
+	id_table:	cpia_id_table,
 };
 
 /* don't use dev, it may be NULL! (see usb_cpia_cleanup) */

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)