[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1466453164-13185-5-git-send-email-dave@stgolabs.net>
Date: Mon, 20 Jun 2016 13:05:56 -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,
Davidlohr Bueso <dbueso@...e.de>
Subject: [PATCH 04/12] EDAC: 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: Doug Thompson <dougthompson@...ssion.com>
Cc: Borislav Petkov <bp@...en8.de>
Cc: Mauro Carvalho Chehab <mchehab@....samsung.com>
Signed-off-by: Davidlohr Bueso <dbueso@...e.de>
---
drivers/edac/edac_device.c | 2 +-
drivers/edac/edac_pci.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/edac/edac_device.c b/drivers/edac/edac_device.c
index a97900333e2d..00a6ea02ac0d 100644
--- a/drivers/edac/edac_device.c
+++ b/drivers/edac/edac_device.c
@@ -470,7 +470,7 @@ int edac_device_alloc_index(void)
{
static atomic_t device_indexes = ATOMIC_INIT(0);
- return atomic_inc_return(&device_indexes) - 1;
+ return atomic_fetch_inc(&device_indexes);
}
EXPORT_SYMBOL_GPL(edac_device_alloc_index);
diff --git a/drivers/edac/edac_pci.c b/drivers/edac/edac_pci.c
index 8f2f2899a7a2..c6d8f5df4156 100644
--- a/drivers/edac/edac_pci.c
+++ b/drivers/edac/edac_pci.c
@@ -224,7 +224,7 @@ static void edac_pci_workq_function(struct work_struct *work_req)
*/
int edac_pci_alloc_index(void)
{
- return atomic_inc_return(&pci_indexes) - 1;
+ return atomic_fetch_inc(&pci_indexes);
}
EXPORT_SYMBOL_GPL(edac_pci_alloc_index);
--
2.6.6
Powered by blists - more mailing lists