--- C:/Documents and Settings/scsmith/Local Settings/Temp/cl_pnp_po.c-revBASE.svn000.tmp.c	Wed Sep 02 08:43:28 2009
+++ C:/Documents and Settings/scsmith/My Documents/openIB-windows/SVN/gen1/branches/WOF2-1/core/complib/kernel/cl_pnp_po.c	Fri Aug 28 16:36:18 2009
@@ -136,7 +136,9 @@
 
 	/* Store the pointer to our own device. */
 	p_ext->p_self_do = p_dev_obj;
+
 	IoInitializeRemoveLock( &p_ext->remove_lock, 'bilc', 15, 1000 );
+	IoInitializeRemoveLock( &p_ext->stop_lock, 'dtci', 0, 1000 );
 
 	/* Initialize the PnP states. */
 	p_ext->pnp_state = NotStarted;
@@ -428,15 +430,6 @@
 	if( NT_SUCCESS( status ) )
 		cl_set_pnp_state( p_ext, Started );
 
-	/*
-	 * If we get the start request when we're already started, don't 
-	 * re-initialize the stop lock.
-	 */
-	if( p_ext->last_pnp_state != Started ) {
-		CL_TRACE( CL_DBG_PNP, p_ext->dbg_lvl, ("IoInitializeRemoveLock: stop_lock %p[\n", &p_ext->stop_lock));
-		IoInitializeRemoveLock( &p_ext->stop_lock, 'dtci', 0, 1000 );
-	}
-
 	CL_EXIT( CL_DBG_PNP, p_ext->dbg_lvl );
 	return status;
 }
@@ -553,33 +546,6 @@
 		CL_TRACE_EXIT( CL_DBG_PNP, p_ext->dbg_lvl,
 			("IRP_MN_CANCEL_STOP_DEVICE received in invalid state.\n") );
 		return status;
-	}
-
-	if( p_ext->last_pnp_state == Started )
-	{
-		/*
-		 * Re-initialize the stop lock before rolling back the PnP
-		 * state so that there's no contention while it's uninitialized.
-		 */
-		CL_TRACE( CL_DBG_PNP, p_ext->dbg_lvl, ("IoInitializeRemoveLock: stop_lock %p[\n", &p_ext->stop_lock));
-		IoInitializeRemoveLock( &p_ext->stop_lock, 'dtci', 0, 1000 );
-#if 0		
-		// leo: it seems like a bug, because it can never get released
-		{
-		/* 
-		 * Acquire the stop lock to allow releasing and waiting when stopping.
-		 */
-			NTSTATUS			status1;
-			CL_TRACE( CL_DBG_PNP, p_ext->dbg_lvl, ("IoAcquireRemoveLock: stop_lock %p[\n", &p_ext->stop_lock));
-			status1 = IoAcquireRemoveLock( &p_ext->stop_lock, NULL );
-			if( !NT_SUCCESS( status1 ) )
-			{
-				CL_TRACE( CL_DBG_ERROR, p_ext->dbg_lvl, 
-					("IoAcquireRemoveLock returned %08x. Continue anyway ...\n", status) );
-			}
-			CL_TRACE( CL_DBG_PNP, p_ext->dbg_lvl, ("IoAcquireRemoveLock: stop_lock ]\n"));
-		}
-#endif		
 	}
 
 	/* Return to the previous PnP state. */
