aboutsummaryrefslogtreecommitdiffstats
path: root/arch/tile/lib/spinlock_64.c
diff options
context:
space:
mode:
authorDaniel Vetter <daniel.vetter@ffwll.ch>2015-07-15 16:36:50 +0200
committerDaniel Vetter <daniel.vetter@ffwll.ch>2015-07-15 16:36:50 +0200
commitca6e4405779ed56ebac941570615abd667c72c02 (patch)
tree1b4fef494bc8d64ed889d52c7aabb4e09e4ffef3 /arch/tile/lib/spinlock_64.c
parentdrm/i915: always disable irqs in intel_pipe_update_start (diff)
parentdrm/i915: Do not call intel_crtc_disable if the crtc is already disabled. (diff)
downloadlinux-dev-ca6e4405779ed56ebac941570615abd667c72c02.tar.xz
linux-dev-ca6e4405779ed56ebac941570615abd667c72c02.zip
Merge tag 'drm-intel-fixes-2015-07-15' into drm-intel-next-queued
Backmerge fixes since it's getting out of hand again with the massive split due to atomic between -next and 4.2-rc. All the bugfixes in 4.2-rc are addressed already (by converting more towards atomic instead of minimal duct-tape) so just always pick the version in next for the conflicts in modeset code. All the other conflicts are just adjacent lines changed. Conflicts: drivers/gpu/drm/i915/i915_drv.h drivers/gpu/drm/i915/i915_gem_gtt.c drivers/gpu/drm/i915/intel_display.c drivers/gpu/drm/i915/intel_drv.h drivers/gpu/drm/i915/intel_ringbuffer.h Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Diffstat (limited to 'arch/tile/lib/spinlock_64.c')
-rw-r--r--arch/tile/lib/spinlock_64.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/arch/tile/lib/spinlock_64.c b/arch/tile/lib/spinlock_64.c
index d6fb9581e980..c8d1f94ff1fe 100644
--- a/arch/tile/lib/spinlock_64.c
+++ b/arch/tile/lib/spinlock_64.c
@@ -65,8 +65,17 @@ EXPORT_SYMBOL(arch_spin_trylock);
void arch_spin_unlock_wait(arch_spinlock_t *lock)
{
u32 iterations = 0;
- while (arch_spin_is_locked(lock))
+ u32 val = READ_ONCE(lock->lock);
+ u32 curr = arch_spin_current(val);
+
+ /* Return immediately if unlocked. */
+ if (arch_spin_next(val) == curr)
+ return;
+
+ /* Wait until the current locker has released the lock. */
+ do {
delay_backoff(iterations++);
+ } while (arch_spin_current(READ_ONCE(lock->lock)) == curr);
}
EXPORT_SYMBOL(arch_spin_unlock_wait);