public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* small patch: enable pwc usb camera driver
@ 2004-06-07 13:00 Kai Engert
  2004-06-07 20:20 ` Greg KH
  0 siblings, 1 reply; 6+ messages in thread
From: Kai Engert @ 2004-06-07 13:00 UTC (permalink / raw)
  To: linux-kernel; +Cc: greg, webcam

[-- Attachment #1: Type: text/plain, Size: 344 bytes --]

The attached patch enables the pwc driver included with kernel 2.6.7-rc2

It also removes the warnings during compilation.
However, note that I blindly duplicated the release approach used by 
other usb camera drivers, replacing the current no-op.

The driver works for me with a Logitech QuickCam Notebook Pro and 
GnomeMeeting.

Regards,
Kai

[-- Attachment #2: pwcdiff --]
[-- Type: text/plain, Size: 1722 bytes --]

diff -ruw org/linux-2.6.7-rc2/drivers/usb/media/Kconfig linux-2.6.7-rc2/drivers/usb/media/Kconfig
--- org/linux-2.6.7-rc2/drivers/usb/media/Kconfig	2004-05-30 08:25:41.000000000 +0200
+++ linux-2.6.7-rc2/drivers/usb/media/Kconfig	2004-06-07 11:27:03.000000000 +0200
@@ -108,7 +108,7 @@
 
 config USB_PWC
 	tristate "USB Philips Cameras"
-	depends on USB && VIDEO_DEV && BROKEN
+	depends on USB && VIDEO_DEV
 	---help---
 	  Say Y or M here if you want to use one of these Philips & OEM
           webcams:
diff -ruw org/linux-2.6.7-rc2/drivers/usb/media/pwc-if.c linux-2.6.7-rc2/drivers/usb/media/pwc-if.c
--- org/linux-2.6.7-rc2/drivers/usb/media/pwc-if.c	2004-05-30 08:26:27.000000000 +0200
+++ linux-2.6.7-rc2/drivers/usb/media/pwc-if.c	2004-06-07 11:42:50.000000000 +0200
@@ -129,7 +129,6 @@
 
 static int pwc_video_open(struct inode *inode, struct file *file);
 static int pwc_video_close(struct inode *inode, struct file *file);
-static int pwc_video_release(struct video_device *);			  
 static ssize_t pwc_video_read(struct file *file, char *buf,
 			  size_t count, loff_t *ppos);
 static unsigned int pwc_video_poll(struct file *file, poll_table *wait);
@@ -1121,12 +1120,6 @@
 	return 0;
 }
 
-static int pwc_video_release(struct video_device *vfd)
-{
-	Trace(TRACE_OPEN, "pwc_video_release() called. Now what?\n");
-}
-		
-
 /*
  *	FIXME: what about two parallel reads ????
  *      ANSWER: Not supported. You can't open the device more than once,
@@ -1855,7 +1848,7 @@
 		}
 	}
 
-	pdev->vdev.release = pwc_video_release;
+	pdev->vdev.release = video_device_release;
 	i = video_register_device(&pdev->vdev, VFL_TYPE_GRABBER, video_nr);
 	if (i < 0) {
 		Err("Failed to register as video device (%d).\n", i);

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: small patch: enable pwc usb camera driver
  2004-06-07 13:00 small patch: enable pwc usb camera driver Kai Engert
@ 2004-06-07 20:20 ` Greg KH
  2004-06-07 22:27   ` Nemosoft Unv.
  0 siblings, 1 reply; 6+ messages in thread
From: Greg KH @ 2004-06-07 20:20 UTC (permalink / raw)
  To: kai.engert; +Cc: linux-kernel, webcam

On Mon, Jun 07, 2004 at 03:00:43PM +0200, Kai Engert wrote:
> The attached patch enables the pwc driver included with kernel 2.6.7-rc2
> 
> It also removes the warnings during compilation.
> However, note that I blindly duplicated the release approach used by 
> other usb camera drivers, replacing the current no-op.
> 
> The driver works for me with a Logitech QuickCam Notebook Pro and 
> GnomeMeeting.

Nice, thanks, I've applied this.  It's amazing how long it took for this
to be fixed... :(

Again, thanks a lot for doing this.

greg k-h

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: small patch: enable pwc usb camera driver
  2004-06-07 20:20 ` Greg KH
@ 2004-06-07 22:27   ` Nemosoft Unv.
  2004-06-07 22:39     ` Greg KH
  0 siblings, 1 reply; 6+ messages in thread
From: Nemosoft Unv. @ 2004-06-07 22:27 UTC (permalink / raw)
  To: Greg KH; +Cc: kai.engert, linux-kernel

On Monday 07 June 2004 22:20, Greg KH wrote:
> On Mon, Jun 07, 2004 at 03:00:43PM +0200, Kai Engert wrote:
> > The attached patch enables the pwc driver included with kernel
> > 2.6.7-rc2
> >
> > It also removes the warnings during compilation.
> > However, note that I blindly duplicated the release approach used by
> > other usb camera drivers, replacing the current no-op.
> >
> > The driver works for me with a Logitech QuickCam Notebook Pro and
> > GnomeMeeting.
>
> Nice, thanks, I've applied this.  

Don't use this. It will BUG() your kernel hard, because of a double free(). 

> It's amazing how long it took for this to be fixed... :(

I could start a big *bleep*ing rant about this, but I´ll save that for some 
other time.

 - Nemosoft


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: small patch: enable pwc usb camera driver
  2004-06-07 22:27   ` Nemosoft Unv.
@ 2004-06-07 22:39     ` Greg KH
  2004-06-17 12:37       ` Kai Engert
  0 siblings, 1 reply; 6+ messages in thread
From: Greg KH @ 2004-06-07 22:39 UTC (permalink / raw)
  To: Nemosoft Unv.; +Cc: kai.engert, linux-kernel

On Tue, Jun 08, 2004 at 12:27:04AM +0200, Nemosoft Unv. wrote:
> On Monday 07 June 2004 22:20, Greg KH wrote:
> > On Mon, Jun 07, 2004 at 03:00:43PM +0200, Kai Engert wrote:
> > > The attached patch enables the pwc driver included with kernel
> > > 2.6.7-rc2
> > >
> > > It also removes the warnings during compilation.
> > > However, note that I blindly duplicated the release approach used by
> > > other usb camera drivers, replacing the current no-op.
> > >
> > > The driver works for me with a Logitech QuickCam Notebook Pro and
> > > GnomeMeeting.
> >
> > Nice, thanks, I've applied this.  
> 
> Don't use this. It will BUG() your kernel hard, because of a double free(). 

Oops, oh well, the pwc driver is really messed up then...
I already sent this to Linus, and as no one has fixed this issue up in a
long time, I'll wait for someone to send another patch fixing this
one as it's obvious that this driver does not have many users :(

> > It's amazing how long it took for this to be fixed... :(
> 
> I could start a big *bleep*ing rant about this, but I?ll save that for some 
> other time.

Heh, we've discussed this already in private, I'll be glad to discuss it
again, any time, in public on any mailing list.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: small patch: enable pwc usb camera driver
  2004-06-07 22:39     ` Greg KH
@ 2004-06-17 12:37       ` Kai Engert
  2004-06-17 19:58         ` Greg KH
  0 siblings, 1 reply; 6+ messages in thread
From: Kai Engert @ 2004-06-17 12:37 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg KH, Nemosoft Unv.

[-- Attachment #1: Type: text/plain, Size: 764 bytes --]

Greg KH wrote:
> On Tue, Jun 08, 2004 at 12:27:04AM +0200, Nemosoft Unv. wrote:
>> ... 
>>Don't use this. It will BUG() your kernel hard, because of a double free(). 

I confirm, if you disconnect the device / unload the driver, it doesn't 
take long and the kernel reports an exception. My fault, sorry.

> ... I'll wait for someone to send another patch fixing this one ...

I'm attaching a new patch:

- revert video device release code to original no-op,
   using correct function signature.

With this patch applied to 2.6.7, I am able to connect/disconnect the 
camera, load/unload the driver 20 times and everything still works fine.

No warnings during compilation (which was the original reason to mark 
the driver broken, IIUC).

Thanks and Regards,
Kai

[-- Attachment #2: pwcdiff3 --]
[-- Type: text/plain, Size: 1211 bytes --]

diff -ruw org-267/drivers/usb/media/pwc-if.c linux-2.6.7/drivers/usb/media/pwc-if.c
--- org-267/drivers/usb/media/pwc-if.c	2004-06-16 07:19:44.000000000 +0200
+++ linux-2.6.7/drivers/usb/media/pwc-if.c	2004-06-17 13:49:58.268336544 +0200
@@ -129,6 +129,7 @@
 
 static int pwc_video_open(struct inode *inode, struct file *file);
 static int pwc_video_close(struct inode *inode, struct file *file);
+static void pwc_video_release(struct video_device *);
 static ssize_t pwc_video_read(struct file *file, char *buf,
 			  size_t count, loff_t *ppos);
 static unsigned int pwc_video_poll(struct file *file, poll_table *wait);
@@ -1120,6 +1121,12 @@
 	return 0;
 }
 
+static void pwc_video_release(struct video_device *vfd)
+{
+	/* Do nothing to prevent a double free */
+	Trace(TRACE_OPEN, "pwc_video_release() called.\n");
+}
+
 /*
  *	FIXME: what about two parallel reads ????
  *      ANSWER: Not supported. You can't open the device more than once,
@@ -1848,7 +1855,7 @@
 		}
 	}
 
-	pdev->vdev.release = video_device_release;
+	pdev->vdev.release = pwc_video_release;
 	i = video_register_device(&pdev->vdev, VFL_TYPE_GRABBER, video_nr);
 	if (i < 0) {
 		Err("Failed to register as video device (%d).\n", i);

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: small patch: enable pwc usb camera driver
  2004-06-17 12:37       ` Kai Engert
@ 2004-06-17 19:58         ` Greg KH
  0 siblings, 0 replies; 6+ messages in thread
From: Greg KH @ 2004-06-17 19:58 UTC (permalink / raw)
  To: kai.engert; +Cc: linux-kernel, Nemosoft Unv.

On Thu, Jun 17, 2004 at 02:37:51PM +0200, Kai Engert wrote:
> Greg KH wrote:
> >On Tue, Jun 08, 2004 at 12:27:04AM +0200, Nemosoft Unv. wrote:
> >>... 
> >>Don't use this. It will BUG() your kernel hard, because of a double 
> >>free(). 
> 
> I confirm, if you disconnect the device / unload the driver, it doesn't 
> take long and the kernel reports an exception. My fault, sorry.
> 
> >... I'll wait for someone to send another patch fixing this one ...
> 
> I'm attaching a new patch:
> 
> - revert video device release code to original no-op,
>   using correct function signature.

Ick ick ick!  No, that's not the way to fix this.

Bah, time to mark the driver broken again...

greg k-h

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2004-06-17 20:23 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-06-07 13:00 small patch: enable pwc usb camera driver Kai Engert
2004-06-07 20:20 ` Greg KH
2004-06-07 22:27   ` Nemosoft Unv.
2004-06-07 22:39     ` Greg KH
2004-06-17 12:37       ` Kai Engert
2004-06-17 19:58         ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox