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 <[email protected]> Cc: Borislav Petkov <[email protected]> Cc: Mauro Carvalho Chehab <[email protected]> Signed-off-by: Davidlohr Bueso <[email protected]> --- 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

