[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1466453164-13185-12-git-send-email-dave@stgolabs.net>
Date: Mon, 20 Jun 2016 13:06:03 -0700
From: Davidlohr Bueso <dave@...olabs.net>
To: peterz@...radead.org, mingo@...nel.org
Cc: davem@...emloft.net, cw00.choi@...sung.com,
dougthompson@...ssion.com, bp@...en8.de, mchehab@....samsung.com,
gregkh@...uxfoundation.org, pfg@....com, jikos@...nel.org,
hans.verkuil@...co.com, awalls@...metrocast.net,
dledford@...hat.com, sean.hefty@...el.com, kys@...rosoft.com,
heiko.carstens@...ibm.com, James.Bottomley@...senPartnership.com,
sumit.semwal@...aro.org, schwidefsky@...ibm.com,
linux-kernel@...r.kernel.org, dave@...olabs.net,
"Martin K. Petersen" <martin.petersen@...cle.com>,
Davidlohr Bueso <dbueso@...e.de>
Subject: [PATCH 11/12] scsi: Employ atomic_fetch_inc()
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: "James E.J. Bottomley" <James.Bottomley@...senPartnership.com>
Cc: "Martin K. Petersen" <martin.petersen@...cle.com>
Signed-off-by: Davidlohr Bueso <dbueso@...e.de>
---
drivers/scsi/fcoe/fcoe_sysfs.c | 4 ++--
drivers/scsi/scsi_lib.c | 6 +++---
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/scsi/fcoe/fcoe_sysfs.c b/drivers/scsi/fcoe/fcoe_sysfs.c
index 045c4e11ee54..3d6833fbdea7 100644
--- a/drivers/scsi/fcoe/fcoe_sysfs.c
+++ b/drivers/scsi/fcoe/fcoe_sysfs.c
@@ -685,7 +685,7 @@ struct fcoe_ctlr_device *fcoe_ctlr_device_add(struct device *parent,
if (!ctlr)
goto out;
- ctlr->id = atomic_inc_return(&ctlr_num) - 1;
+ ctlr->id = atomic_fetch_inc(&ctlr_num);
ctlr->f = f;
ctlr->mode = FIP_CONN_TYPE_FABRIC;
INIT_LIST_HEAD(&ctlr->fcfs);
@@ -902,7 +902,7 @@ struct fcoe_fcf_device *fcoe_fcf_device_add(struct fcoe_ctlr_device *ctlr,
fcf->dev.parent = &ctlr->dev;
fcf->dev.bus = &fcoe_bus_type;
fcf->dev.type = &fcoe_fcf_device_type;
- fcf->id = atomic_inc_return(&fcf_num) - 1;
+ fcf->id = atomic_fetch_inc(&fcf_num);
fcf->state = FCOE_FCF_STATE_UNKNOWN;
fcf->dev_loss_tmo = ctlr->fcf_dev_loss_tmo;
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index c71344aebdbb..113ec916210d 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -1322,7 +1322,7 @@ static inline int scsi_dev_queue_ready(struct request_queue *q,
{
unsigned int busy;
- busy = atomic_inc_return(&sdev->device_busy) - 1;
+ busy = atomic_fetch_inc(&sdev->device_busy);
if (atomic_read(&sdev->device_blocked)) {
if (busy)
goto out_dec;
@@ -1375,7 +1375,7 @@ static inline int scsi_target_queue_ready(struct Scsi_Host *shost,
if (starget->can_queue <= 0)
return 1;
- busy = atomic_inc_return(&starget->target_busy) - 1;
+ busy = atomic_fetch_inc(&starget->target_busy);
if (atomic_read(&starget->target_blocked) > 0) {
if (busy)
goto starved;
@@ -1419,7 +1419,7 @@ static inline int scsi_host_queue_ready(struct request_queue *q,
if (scsi_host_in_recovery(shost))
return 0;
- busy = atomic_inc_return(&shost->host_busy) - 1;
+ busy = atomic_fetch_inc(&shost->host_busy);
if (atomic_read(&shost->host_blocked) > 0) {
if (busy)
goto starved;
--
2.6.6
Powered by blists - more mailing lists