Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

CRIS: assignment/is equal confusion

Somehow, the assignments of rw->lock got written as comparisons.
The effect probably was that the read-write spinlocks never locked.
However, since the locks are only used in CONFIG_SMP and SMP CRIS is
experimental, it has never been identified as a problem.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Acked-by: Jesper Nilsson <jesper.nilsson@axis.com>

authored by

Roel Kluin and committed by
Jesper Nilsson
b0903ee8 ccc0d38e

+3 -3
+3 -3
arch/cris/include/arch-v32/arch/spinlock.h
··· 78 78 { 79 79 __raw_spin_lock(&rw->slock); 80 80 while (rw->lock != RW_LOCK_BIAS); 81 - rw->lock == 0; 81 + rw->lock = 0; 82 82 __raw_spin_unlock(&rw->slock); 83 83 } 84 84 ··· 93 93 { 94 94 __raw_spin_lock(&rw->slock); 95 95 while (rw->lock != RW_LOCK_BIAS); 96 - rw->lock == RW_LOCK_BIAS; 96 + rw->lock = RW_LOCK_BIAS; 97 97 __raw_spin_unlock(&rw->slock); 98 98 } 99 99 ··· 114 114 int ret = 0; 115 115 __raw_spin_lock(&rw->slock); 116 116 if (rw->lock == RW_LOCK_BIAS) { 117 - rw->lock == 0; 117 + rw->lock = 0; 118 118 ret = 1; 119 119 } 120 120 __raw_spin_unlock(&rw->slock);