1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-25 11:37:56 +00:00

Fix atomic operations on context_flag without altering semantics.

This commit is contained in:
Jung-uk Kim 2013-08-29 18:36:47 +00:00
parent 4b0f6e5b60
commit 0289d87d9c
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=255037

View File

@ -182,7 +182,7 @@ int drm_setsareactx(struct drm_device *dev, void *data,
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;
}