diff options
author | jkim <jkim@FreeBSD.org> | 2013-08-29 18:36:47 +0000 |
---|---|---|
committer | jkim <jkim@FreeBSD.org> | 2013-08-29 18:36:47 +0000 |
commit | 674c9801f60ed25de2d6fa3d4fbf791a1d79cfa3 (patch) | |
tree | 8dfd8d2ad8acc2161fb9d4ce1aeeef0e8e84b4fd /sys/dev/drm2 | |
parent | 4d90834da43f660fc930f3946a35b5cb4e9b4e55 (diff) | |
download | FreeBSD-src-674c9801f60ed25de2d6fa3d4fbf791a1d79cfa3.zip FreeBSD-src-674c9801f60ed25de2d6fa3d4fbf791a1d79cfa3.tar.gz |
Fix atomic operations on context_flag without altering semantics.
Diffstat (limited to 'sys/dev/drm2')
-rw-r--r-- | sys/dev/drm2/drm_context.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/dev/drm2/drm_context.c b/sys/dev/drm2/drm_context.c index c844a39..9ca941e 100644 --- a/sys/dev/drm2/drm_context.c +++ b/sys/dev/drm2/drm_context.c @@ -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 *dev, int old, int new) 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 drm_device *dev, int new) /* 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; } |