svn commit: r255037 - head/sys/dev/drm2

Jung-uk Kim jkim at FreeBSD.org
Thu Aug 29 18:36:48 UTC 2013


Author: jkim
Date: Thu Aug 29 18:36:47 2013
New Revision: 255037
URL: http://svnweb.freebsd.org/changeset/base/255037

Log:
  Fix atomic operations on context_flag without altering semantics.

Modified:
  head/sys/dev/drm2/drm_context.c

Modified: head/sys/dev/drm2/drm_context.c
==============================================================================
--- head/sys/dev/drm2/drm_context.c	Thu Aug 29 17:45:13 2013	(r255036)
+++ head/sys/dev/drm2/drm_context.c	Thu Aug 29 18:36:47 2013	(r255037)
@@ -182,7 +182,7 @@ bad:
 
 int drm_context_switch(struct drm_device *dev, int old, int new)
 {
-	if (test_and_set_bit(0, &dev->context_flag)) {
+	if (atomic_xchg(&dev->context_flag, 1) != 0) {
 		DRM_ERROR("Reentering -- FIXME\n");
 		return EBUSY;
 	}
@@ -190,7 +190,7 @@ int drm_context_switch(struct drm_device
 	DRM_DEBUG("Context switch from %d to %d\n", old, new);
 
 	if (new == dev->last_context) {
-		clear_bit(0, &dev->context_flag);
+		atomic_xchg(&dev->context_flag, 0);
 		return 0;
 	}
 
@@ -208,7 +208,7 @@ int drm_context_switch_complete(struct d
 	/* If a context switch is ever initiated
 	   when the kernel holds the lock, release
 	   that lock here. */
-	clear_bit(0, &dev->context_flag);
+	atomic_xchg(&dev->context_flag, 0);
 
 	return 0;
 }


More information about the svn-src-head mailing list