linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH][2.5][CHECKER] i2c-core locking
@ 2003-03-03  4:26 Zwane Mwaikambo
  2003-03-03  7:42 ` Christoph Hellwig
  0 siblings, 1 reply; 2+ messages in thread
From: Zwane Mwaikambo @ 2003-03-03  4:26 UTC (permalink / raw)
  To: Linux Kernel

This one looks like it wasn't dropping the driver mutex on some exit 
paths.

Index: linux-2.5.62-numaq/drivers/i2c/i2c-core.c
===================================================================
RCS file: /build/cvsroot/linux-2.5.62/drivers/i2c/i2c-core.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 i2c-core.c
--- linux-2.5.62-numaq/drivers/i2c/i2c-core.c	18 Feb 2003 00:15:36 -0000	1.1.1.1
+++ linux-2.5.62-numaq/drivers/i2c/i2c-core.c	3 Mar 2003 04:13:01 -0000
@@ -289,6 +289,7 @@
 {
 	int i,j,k,res;
 
+	ADAP_LOCK();
 	DRV_LOCK();
 	for (i = 0; i < I2C_DRIVER_MAX; i++)
 		if (driver == drivers[i])
@@ -298,6 +299,7 @@
 				    "[%s] not found\n",
 			driver->name);
 		DRV_UNLOCK();
+		ADAP_UNLOCK();
 		return -ENODEV;
 	}
 	/* Have a look at each adapter, if clients of this driver are still
@@ -309,7 +311,6 @@
 	 * invalid operation might (will!) result, when using stale client
 	 * pointers.
 	 */
-	ADAP_LOCK(); /* should be moved inside the if statement... */
 	for (k=0;k<I2C_ADAP_MAX;k++) {
 		struct i2c_adapter *adap = adapters[k];
 		if (adap == NULL) /* skip empty entries. */
@@ -328,6 +329,7 @@
 				       "not be detached properly; driver "
 				       "not unloaded!",driver->name,
 				       adap->name);
+				DRV_UNLOCK();
 				ADAP_UNLOCK();
 				return res;
 			}
@@ -352,6 +354,7 @@
 						       driver->name,
 						       client->addr,
 						       adap->name);
+						DRV_UNLOCK();
 						ADAP_UNLOCK();
 						return res;
 					}
@@ -359,11 +362,10 @@
 			}
 		}
 	}
-	ADAP_UNLOCK();
 	drivers[i] = NULL;
 	driver_count--;
 	DRV_UNLOCK();
-	
+	ADAP_UNLOCK();	
 	DEB(printk(KERN_DEBUG "i2c-core.o: driver unregistered: %s\n",driver->name));
 	return 0;
 }

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

* Re: [PATCH][2.5][CHECKER] i2c-core locking
  2003-03-03  4:26 [PATCH][2.5][CHECKER] i2c-core locking Zwane Mwaikambo
@ 2003-03-03  7:42 ` Christoph Hellwig
  0 siblings, 0 replies; 2+ messages in thread
From: Christoph Hellwig @ 2003-03-03  7:42 UTC (permalink / raw)
  To: Zwane Mwaikambo; +Cc: Linux Kernel

On Sun, Mar 02, 2003 at 11:26:29PM -0500, Zwane Mwaikambo wrote:
> This one looks like it wasn't dropping the driver mutex on some exit 
> paths.

Please leave this as-is for now.  lm_sensors CVS has replaced the two
with a single semaphore and I plan to bring their changes over to
mainline soon.


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

end of thread, other threads:[~2003-03-03  7:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-03-03  4:26 [PATCH][2.5][CHECKER] i2c-core locking Zwane Mwaikambo
2003-03-03  7:42 ` Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).