forked from Minki/linux
s390/qdio: use atomic_cmpxchg
qdio uses atomic_read to find an unused indicator and atomic_set to flag it as used. This could lead to multiple users getting the same indicator. Use atomic_cmpxchg instead. Signed-off-by: Sebastian Ott <sebott@linux.vnet.ibm.com> Acked-by: Ursula Braun <ubraun@linux.vnet.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
This commit is contained in:
parent
2a2d7befd4
commit
648a6f4495
@ -56,10 +56,8 @@ static u32 *get_indicator(void)
|
||||
int i;
|
||||
|
||||
for (i = 0; i < TIQDIO_NR_NONSHARED_IND; i++)
|
||||
if (!atomic_read(&q_indicators[i].count)) {
|
||||
atomic_set(&q_indicators[i].count, 1);
|
||||
if (!atomic_cmpxchg(&q_indicators[i].count, 0, 1))
|
||||
return &q_indicators[i].ind;
|
||||
}
|
||||
|
||||
/* use the shared indicator */
|
||||
atomic_inc(&q_indicators[TIQDIO_SHARED_IND].count);
|
||||
|
Loading…
Reference in New Issue
Block a user