[PATCH 10/12] s390/scm_block: Employ atomic_fetch_inc()

From: Davidlohr Bueso
Date: Mon Jun 20 2016 - 16:09:12 EST


Now that we have fetch_inc() we can stop using inc_return() - 1.

These are very similar to the existing OP-RETURN primitives we already
have, except they return the value of the atomic variable _before_
modification.

Cc: Martin Schwidefsky <schwidefsky@xxxxxxxxxx>
Cc: Heiko Carstens <heiko.carstens@xxxxxxxxxx>
Signed-off-by: Davidlohr Bueso <dbueso@xxxxxxx>
---
drivers/s390/block/scm_blk.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/s390/block/scm_blk.c b/drivers/s390/block/scm_blk.c
index e6f54d3b8969..eef68990474a 100644
--- a/drivers/s390/block/scm_blk.c
+++ b/drivers/s390/block/scm_blk.c
@@ -475,7 +475,7 @@ int scm_blk_dev_setup(struct scm_blk_dev *bdev, struct scm_device *scmdev)
int len, ret = -ENOMEM;
unsigned int devindex, nr_max_blk;

- devindex = atomic_inc_return(&nr_devices) - 1;
+ devindex = atomic_fetch_inc(&nr_devices);
/* scma..scmz + scmaa..scmzz */
if (devindex > 701) {
ret = -ENODEV;
--
2.6.6