diff options
author | Sebastian Ott <sebott@linux.vnet.ibm.com> | 2017-10-26 16:36:45 +0200 |
---|---|---|
committer | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2017-11-03 08:00:28 +0100 |
commit | 648a6f4495b183d4e0d8983ff768facb9a2185bb (patch) | |
tree | a8ea80bbc79bfe42948ecf2ce46ee2c754b31c76 | |
parent | 2a2d7befd40c95fd0d27d14edd0ec3b479fcf21f (diff) | |
download | op-kernel-dev-648a6f4495b183d4e0d8983ff768facb9a2185bb.zip op-kernel-dev-648a6f4495b183d4e0d8983ff768facb9a2185bb.tar.gz |
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>
-rw-r--r-- | drivers/s390/cio/qdio_thinint.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/drivers/s390/cio/qdio_thinint.c b/drivers/s390/cio/qdio_thinint.c index c61164f..3e587bf 100644 --- a/drivers/s390/cio/qdio_thinint.c +++ b/drivers/s390/cio/qdio_thinint.c @@ -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); |