Subject: [PATCH 1 of 5] USB ov511 driver bugfixes
From: Greg KH <[email-masked]>
To: Marcelo Tosatti <[email-masked]>
Cc: [email-masked]

Hi,

Here's a patch against 2.4.18-pre6 for the USB ov511 driver that fixes
an oops that happens with ioctl() is called on the driver's proc entry.
This patch was done by Mark McClelland.

thanks,

greg k-h

diff -Nru a/drivers/usb/ov511.c b/drivers/usb/ov511.c
--- a/drivers/usb/ov511.c	Sat Jan 26 19:56:09 2002
+++ b/drivers/usb/ov511.c	Sat Jan 26 19:56:09 2002
@@ -57,7 +57,7 @@
 /*
  * Version Information
  */
-#define DRIVER_VERSION "v1.48 for Linux 2.4"
+#define DRIVER_VERSION "v1.48a for Linux 2.4"
 #define EMAIL "[email-masked]"
 #define DRIVER_AUTHOR "Mark McClelland <[email-masked]> & Bret Wallach \
 	& Orion Sky Lawlor <[email-masked]> & Kevin Moore & Charl P. Botha \
@@ -492,6 +492,10 @@
 static struct proc_dir_entry *ov511_proc_entry = NULL;
 extern struct proc_dir_entry *video_proc_entry;
 
+static struct file_operations ov511_control_fops = {
+	ioctl:		ov511_control_ioctl,
+};
+
 #define YES_NO(x) ((x) ? "yes" : "no")
 
 /* /proc/video/ov511/<minor#>/info */
@@ -673,8 +677,8 @@
 		unlock_kernel();
 		return;
 	}
-	ov511->proc_control->proc_fops->ioctl = ov511_control_ioctl;
 	ov511->proc_control->data = ov511;
+	ov511->proc_control->proc_fops = &ov511_control_fops;
 	unlock_kernel();
 }
 
@@ -6893,13 +6897,13 @@
 		}
 	}
 
-	usb_driver_release_interface(&ov511_driver,
-		&ov511->dev->actconfig->interface[ov511->iface]);
-	ov511->dev = NULL;
-
 #if defined(CONFIG_PROC_FS) && defined(CONFIG_VIDEO_PROC_FS)
         destroy_proc_ov511_cam(ov511);
 #endif
+
+	usb_driver_release_interface(&ov511_driver,
+		&ov511->dev->actconfig->interface[ov511->iface]);
+	ov511->dev = NULL;
 
 	/* Free the memory */
 	if (ov511 && !ov511->user) {