diff mbox

[v2,2/2] ARM: include: asm: use 'int' instead of 'unsigned long' for 'oldval' in atomic_cmpxchg().

Message ID 5253E583.5020805@asianux.com (mailing list archive)
State New, archived
Headers show

Commit Message

Chen Gang Oct. 8, 2013, 10:59 a.m. UTC
For atomic_cmpxchg(), the type of 'oldval' need be 'int' to match the
type of "*ptr" (used by 'ldrex' instruction) and 'old' (used by 'teq'
instruction).

Signed-off-by: Chen Gang <gang.chen@asianux.com>
---
 arch/arm/include/asm/atomic.h |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

Comments

Will Deacon Oct. 9, 2013, 10:48 a.m. UTC | #1
On Tue, Oct 08, 2013 at 11:59:15AM +0100, Chen Gang wrote:
> For atomic_cmpxchg(), the type of 'oldval' need be 'int' to match the
> type of "*ptr" (used by 'ldrex' instruction) and 'old' (used by 'teq'
> instruction).
> 
> Signed-off-by: Chen Gang <gang.chen@asianux.com>
> ---
>  arch/arm/include/asm/atomic.h |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
> 
> diff --git a/arch/arm/include/asm/atomic.h b/arch/arm/include/asm/atomic.h
> index a715ac0..9ee7e01 100644
> --- a/arch/arm/include/asm/atomic.h
> +++ b/arch/arm/include/asm/atomic.h
> @@ -114,7 +114,8 @@ static inline int atomic_sub_return(int i, atomic_t *v)
>  
>  static inline int atomic_cmpxchg(atomic_t *ptr, int old, int new)
>  {
> -	unsigned long oldval, res;
> +	int oldval;
> +	unsigned long res;
>  
>  	smp_mb();

As discussed, this is completely cosmetic, but does at least keep the file
consistent.

  Reviewed-by: Will Deacon <will.deacon@arm.com>

Will
Chen Gang Oct. 10, 2013, 12:56 a.m. UTC | #2
On 10/09/2013 06:48 PM, Will Deacon wrote:
> On Tue, Oct 08, 2013 at 11:59:15AM +0100, Chen Gang wrote:
>> For atomic_cmpxchg(), the type of 'oldval' need be 'int' to match the
>> type of "*ptr" (used by 'ldrex' instruction) and 'old' (used by 'teq'
>> instruction).
>>
>> Signed-off-by: Chen Gang <gang.chen@asianux.com>
>> ---
>>  arch/arm/include/asm/atomic.h |    3 ++-
>>  1 files changed, 2 insertions(+), 1 deletions(-)
>>
>> diff --git a/arch/arm/include/asm/atomic.h b/arch/arm/include/asm/atomic.h
>> index a715ac0..9ee7e01 100644
>> --- a/arch/arm/include/asm/atomic.h
>> +++ b/arch/arm/include/asm/atomic.h
>> @@ -114,7 +114,8 @@ static inline int atomic_sub_return(int i, atomic_t *v)
>>  
>>  static inline int atomic_cmpxchg(atomic_t *ptr, int old, int new)
>>  {
>> -	unsigned long oldval, res;
>> +	int oldval;
>> +	unsigned long res;
>>  
>>  	smp_mb();
> 
> As discussed, this is completely cosmetic, but does at least keep the file
> consistent.
> 
>   Reviewed-by: Will Deacon <will.deacon@arm.com>
> 

Hmm... it seems better to let you as "Signed-of-by" too, for this is
mainly found by you. :-)

And I feel, these kinds of files are the dresses of 'arm32/64' (just
like "asm-generic/*" are the dresses of 'arch'), so not only consider
about whether useful, but also need consider about whether clean.

> Will
> 
> 

Thanks.
diff mbox

Patch

diff --git a/arch/arm/include/asm/atomic.h b/arch/arm/include/asm/atomic.h
index a715ac0..9ee7e01 100644
--- a/arch/arm/include/asm/atomic.h
+++ b/arch/arm/include/asm/atomic.h
@@ -114,7 +114,8 @@  static inline int atomic_sub_return(int i, atomic_t *v)
 
 static inline int atomic_cmpxchg(atomic_t *ptr, int old, int new)
 {
-	unsigned long oldval, res;
+	int oldval;
+	unsigned long res;
 
 	smp_mb();