[cpia] [patch] semaphore deadlock

Johannes Erdfelt jerdfelt@valinux.com
Mon, 17 Apr 2000 19:21:31 -0700


--YhFoJY/gx7awiIuK
Content-Type: text/plain; charset=us-ascii

This is actually a bug I found a little while ago, but I forgot to send
to the list.

Well, I ran into it again and fixed it again.

In do_command, we down a semaphore, but don't up it if the command failed.

For some reason, one of my cameras fails (STALLs the control pipe) every
so often, triggering this bug.

This will up the semaphore in the error path.

It also fixes a minor nit in the beginning for cpia_usb.c :)

I'll submit something like this for the 2.3 version. Can someone submit the
patch for 2.2?

JE


--YhFoJY/gx7awiIuK
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="cpia-sema-fix.patch"

Index: module/cpia.c
===================================================================
RCS file: /cvsroot/webcam/cpia/module/cpia.c,v
retrieving revision 0.12
diff -u -r0.12 cpia.c
--- module/cpia.c	2000/04/17 14:53:40	0.12
+++ module/cpia.c	2000/04/18 02:18:06
@@ -1688,9 +1688,13 @@
 	cmd[7] = 0;
 
 	retval = cam->ops->transferCmd(cam->lowlevel_data, cmd, data);
-	if (retval)
+	if (retval) {
 		DBG("%x - failed, retval=%d\n", command, retval);
-	else {
+		if (command == CPIA_COMMAND_GetColourParams ||
+		    command == CPIA_COMMAND_GetColourBalance ||
+		    command == CPIA_COMMAND_GetExposure)
+			up(&cam->param_lock);
+	} else {
 		switch(command) {
 		case CPIA_COMMAND_GetCPIAVersion:
 			cam->params.version.firmwareVersion = data[0];
Index: module/cpia_usb.c
===================================================================
RCS file: /cvsroot/webcam/cpia/module/cpia_usb.c,v
retrieving revision 0.10
diff -u -r0.10 cpia_usb.c
--- module/cpia_usb.c	2000/04/17 14:53:40	0.10
+++ module/cpia_usb.c	2000/04/18 02:18:06
@@ -1,5 +1,5 @@
 /*
- * cpia_pp CPiA USB driver
+ * cpia_usb CPiA USB driver
  *
  * Supports CPiA based parallel port Video Camera's.
  *

--YhFoJY/gx7awiIuK--