public inbox for linux-arch@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] arch: x86: include: asm: need 'unsigned' type cast for atomic_clear_mask()
@ 2013-06-08  6:30 Chen Gang
  2013-06-08  6:30 ` Chen Gang
  2013-06-08  7:31 ` H. Peter Anvin
  0 siblings, 2 replies; 5+ messages in thread
From: Chen Gang @ 2013-06-08  6:30 UTC (permalink / raw)
  To: Thomas Gleixner, mingo@redhat.com, H. Peter Anvin
  Cc: the arch/x86 maintainers, Andrew Morton, Paul McKenney, shli,
	dhowells@redhat.com, linux-kernel@vger.kernel.org, Linux-Arch


atomic_set_mask() has already have 'unsigned' type case, and
atomic_clear_mask() is the pair of atomic_set_mask().

So it also need 'unsigned' type case.


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

diff --git a/arch/x86/include/asm/atomic.h b/arch/x86/include/asm/atomic.h
index 722aa3b..5b5cf52 100644
--- a/arch/x86/include/asm/atomic.h
+++ b/arch/x86/include/asm/atomic.h
@@ -255,7 +255,7 @@ static inline void atomic_or_long(unsigned long *v1, unsigned long v2)
 /* These are x86-specific, used by some header files */
 #define atomic_clear_mask(mask, addr)				\
 	asm volatile(LOCK_PREFIX "andl %0,%1"			\
-		     : : "r" (~(mask)), "m" (*(addr)) : "memory")
+		     : : "r" (~(unsigned)(mask)), "m" (*(addr)) : "memory")
 
 #define atomic_set_mask(mask, addr)				\
 	asm volatile(LOCK_PREFIX "orl %0,%1"			\
-- 
1.7.7.6

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH] arch: x86: include: asm: need 'unsigned' type cast for atomic_clear_mask()
  2013-06-08  6:30 [PATCH] arch: x86: include: asm: need 'unsigned' type cast for atomic_clear_mask() Chen Gang
@ 2013-06-08  6:30 ` Chen Gang
  2013-06-08  7:31 ` H. Peter Anvin
  1 sibling, 0 replies; 5+ messages in thread
From: Chen Gang @ 2013-06-08  6:30 UTC (permalink / raw)
  To: Thomas Gleixner, mingo@redhat.com, H. Peter Anvin
  Cc: the arch/x86 maintainers, Andrew Morton, Paul McKenney, shli,
	dhowells@redhat.com, linux-kernel@vger.kernel.org, Linux-Arch


atomic_set_mask() has already have 'unsigned' type case, and
atomic_clear_mask() is the pair of atomic_set_mask().

So it also need 'unsigned' type case.


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

diff --git a/arch/x86/include/asm/atomic.h b/arch/x86/include/asm/atomic.h
index 722aa3b..5b5cf52 100644
--- a/arch/x86/include/asm/atomic.h
+++ b/arch/x86/include/asm/atomic.h
@@ -255,7 +255,7 @@ static inline void atomic_or_long(unsigned long *v1, unsigned long v2)
 /* These are x86-specific, used by some header files */
 #define atomic_clear_mask(mask, addr)				\
 	asm volatile(LOCK_PREFIX "andl %0,%1"			\
-		     : : "r" (~(mask)), "m" (*(addr)) : "memory")
+		     : : "r" (~(unsigned)(mask)), "m" (*(addr)) : "memory")
 
 #define atomic_set_mask(mask, addr)				\
 	asm volatile(LOCK_PREFIX "orl %0,%1"			\
-- 
1.7.7.6

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] arch: x86: include: asm: need 'unsigned' type cast for atomic_clear_mask()
  2013-06-08  6:30 [PATCH] arch: x86: include: asm: need 'unsigned' type cast for atomic_clear_mask() Chen Gang
  2013-06-08  6:30 ` Chen Gang
@ 2013-06-08  7:31 ` H. Peter Anvin
  2013-06-08  8:02   ` Chen Gang
  1 sibling, 1 reply; 5+ messages in thread
From: H. Peter Anvin @ 2013-06-08  7:31 UTC (permalink / raw)
  To: Chen Gang
  Cc: Thomas Gleixner, mingo@redhat.com, the arch/x86 maintainers,
	Andrew Morton, Paul McKenney, shli, dhowells@redhat.com,
	linux-kernel@vger.kernel.org, Linux-Arch

On 06/07/2013 11:30 PM, Chen Gang wrote:
> 
> atomic_set_mask() has already have 'unsigned' type case, and
> atomic_clear_mask() is the pair of atomic_set_mask().
> 
> So it also need 'unsigned' type case.
> 

Pray tell, in what situation does this matter?  The only reason I can
think of is if "mask" is actually a long...

	-hpa

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] arch: x86: include: asm: need 'unsigned' type cast for atomic_clear_mask()
  2013-06-08  7:31 ` H. Peter Anvin
@ 2013-06-08  8:02   ` Chen Gang
  2013-06-08  8:25     ` Chen Gang
  0 siblings, 1 reply; 5+ messages in thread
From: Chen Gang @ 2013-06-08  8:02 UTC (permalink / raw)
  To: H. Peter Anvin
  Cc: Thomas Gleixner, mingo@redhat.com, the arch/x86 maintainers,
	Andrew Morton, Paul McKenney, shli, dhowells@redhat.com,
	linux-kernel@vger.kernel.org, Linux-Arch

On 06/08/2013 03:31 PM, H. Peter Anvin wrote:
> On 06/07/2013 11:30 PM, Chen Gang wrote:
>> > 
>> > atomic_set_mask() has already have 'unsigned' type case, and
>> > atomic_clear_mask() is the pair of atomic_set_mask().
>> > 
>> > So it also need 'unsigned' type case.
>> > 
> Pray tell, in what situation does this matter?  The only reason I can
> think of is if "mask" is actually a long...

Excuse me, in fact, I don't know whether it will cause issue. Since
atomic_set_mask() has done, I think atomic_clear_mask() also need it.

If atomic_clear_mask() do need it, the atomic_set_mask() do not need it
either, they are the pairs --> they will face the same situation.


Thanks.
-- 
Chen Gang

Asianux Corporation

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] arch: x86: include: asm: need 'unsigned' type cast for atomic_clear_mask()
  2013-06-08  8:02   ` Chen Gang
@ 2013-06-08  8:25     ` Chen Gang
  0 siblings, 0 replies; 5+ messages in thread
From: Chen Gang @ 2013-06-08  8:25 UTC (permalink / raw)
  To: H. Peter Anvin
  Cc: Thomas Gleixner, mingo@redhat.com, the arch/x86 maintainers,
	Andrew Morton, Paul McKenney, shli, dhowells@redhat.com,
	linux-kernel@vger.kernel.org, Linux-Arch

On 06/08/2013 04:02 PM, Chen Gang wrote:
> On 06/08/2013 03:31 PM, H. Peter Anvin wrote:
>> > On 06/07/2013 11:30 PM, Chen Gang wrote:
>>>> >> > 
>>>> >> > atomic_set_mask() has already have 'unsigned' type case, and
>>>> >> > atomic_clear_mask() is the pair of atomic_set_mask().
>>>> >> > 
>>>> >> > So it also need 'unsigned' type case.
>>>> >> > 
>> > Pray tell, in what situation does this matter?  The only reason I can
>> > think of is if "mask" is actually a long...
> Excuse me, in fact, I don't know whether it will cause issue. Since
> atomic_set_mask() has done, I think atomic_clear_mask() also need it.
> 
> If atomic_clear_mask() do need it, the atomic_set_mask() do not need it
> either, they are the pairs --> they will face the same situation.

Oh, my typo, it should be "If atomic_clear_mask() do not need it, the
atomic_set_mask() do not need it either, the are face same situation".


Thanks.
-- 
Chen Gang

Asianux Corporation

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-06-08  8:26 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-08  6:30 [PATCH] arch: x86: include: asm: need 'unsigned' type cast for atomic_clear_mask() Chen Gang
2013-06-08  6:30 ` Chen Gang
2013-06-08  7:31 ` H. Peter Anvin
2013-06-08  8:02   ` Chen Gang
2013-06-08  8:25     ` Chen Gang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox