From 24c44026db0e590424060c809f343792c89a3055 Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Wed, 3 Jun 2015 09:44:08 +0700 Subject: [PATCH] atomic: Add const declaration to atomic_get The atomic_get() function is a read-only API which doesn't modify the value given to it. The input parameter should therefore be declared as const. Change-Id: I084b7beb623610412f9237fc9dae6139580e2636 Signed-off-by: Johan Hedberg --- arch/x86/core/nanoatomic_nolock.c | 2 +- include/atomic.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86/core/nanoatomic_nolock.c b/arch/x86/core/nanoatomic_nolock.c index 8b3b3b0932a..90237fc6bfa 100644 --- a/arch/x86/core/nanoatomic_nolock.c +++ b/arch/x86/core/nanoatomic_nolock.c @@ -199,7 +199,7 @@ atomic_val_t atomic_dec( * RETURNS: The value read from */ -atomic_val_t atomic_get(atomic_t *target /* memory location to read from */ +atomic_val_t atomic_get(const atomic_t *target /* memory location to read from */ ) { return *target; diff --git a/include/atomic.h b/include/atomic.h index 375a1532082..6c58cd2e561 100644 --- a/include/atomic.h +++ b/include/atomic.h @@ -49,7 +49,7 @@ extern atomic_val_t atomic_or(atomic_t *target, atomic_val_t value); extern atomic_val_t atomic_sub(atomic_t *target, atomic_val_t value); extern atomic_val_t atomic_xor(atomic_t *target, atomic_val_t value); extern atomic_val_t atomic_clear(atomic_t *target); -extern atomic_val_t atomic_get(atomic_t *target); +extern atomic_val_t atomic_get(const atomic_t *target); extern atomic_val_t atomic_set(atomic_t *target, atomic_val_t value); extern int atomic_cas(atomic_t *target, atomic_val_t oldValue, atomic_val_t newValue);