svn commit: r212916 - user/weongyo/usb/sys/dev/usb

Weongyo Jeong weongyo at FreeBSD.org
Mon Sep 20 19:13:01 UTC 2010


Author: weongyo
Date: Mon Sep 20 19:13:00 2010
New Revision: 212916
URL: http://svn.freebsd.org/changeset/base/212916

Log:
  Commits a experimental commit to remove a trick that this commit would
  cause a crash when the recursive holding is happend but I'd like to see
  where it comes from and solves it with better approach.

Modified:
  user/weongyo/usb/sys/dev/usb/usb_busdma.c

Modified: user/weongyo/usb/sys/dev/usb/usb_busdma.c
==============================================================================
--- user/weongyo/usb/sys/dev/usb/usb_busdma.c	Mon Sep 20 18:58:44 2010	(r212915)
+++ user/weongyo/usb/sys/dev/usb/usb_busdma.c	Mon Sep 20 19:13:00 2010	(r212916)
@@ -418,18 +418,10 @@ usb_pc_common_mem_cb(void *arg, bus_dma_
 	struct usb_page_cache *pc;
 	struct usb_page *pg;
 	usb_size_t rem;
-	uint8_t owned;
 
 	pc = arg;
 	uptag = pc->tag_parent;
 
-	/*
-	 * XXX There is sometimes recursive locking here.
-	 * XXX We should try to find a better solution.
-	 * XXX Until further the "owned" variable does
-	 * XXX the trick.
-	 */
-
 	if (error) {
 		goto done;
 	}
@@ -457,18 +449,14 @@ usb_pc_common_mem_cb(void *arg, bus_dma_
 	}
 
 done:
-	owned = mtx_owned(uptag->mtx);
-	if (!owned)
-		mtx_lock(uptag->mtx);
-
+	mtx_lock(uptag->mtx);
 	uptag->dma_error = (error ? 1 : 0);
 	if (isload) {
 		(uptag->func) (uptag);
 	} else {
 		cv_broadcast(uptag->cv);
 	}
-	if (!owned)
-		mtx_unlock(uptag->mtx);
+	mtx_unlock(uptag->mtx);
 }
 
 /*------------------------------------------------------------------------*


More information about the svn-src-user mailing list