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:
parent
4b0f6e5b60
commit
0289d87d9c
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=255037
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user