* [PATCH] Remove casts from atomic macros
@ 2009-04-04 20:54 Bastian Blank
2009-04-05 2:56 ` Kyle McMartin
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Bastian Blank @ 2009-04-04 20:54 UTC (permalink / raw)
To: linux-parisc
The atomic operations on parisc are defined as macros. The macros
includes casts which disallows the use of some syntax elements and
produces error like this:
net/phonet/pep.c: In function 'pipe_rcv_status':
net/phonet/pep.c:262: error: lvalue required as left operand of assignment
The patch removes this superfluous casts.
Signed-off-by: Bastian Blank <waldi@debian.org>
diff --git a/arch/parisc/include/asm/atomic.h b/arch/parisc/include/asm/atomic.h
index edbfe25..43e101b 100644
--- a/arch/parisc/include/asm/atomic.h
+++ b/arch/parisc/include/asm/atomic.h
@@ -222,13 +222,13 @@ static __inline__ int atomic_add_unless(atomic_t *v, int a, int u)
#define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0)
-#define atomic_add(i,v) ((void)(__atomic_add_return( ((int)i),(v))))
-#define atomic_sub(i,v) ((void)(__atomic_add_return(-((int)i),(v))))
+#define atomic_add(i,v) ((void)(__atomic_add_return( (i),(v))))
+#define atomic_sub(i,v) ((void)(__atomic_add_return(-(i),(v))))
#define atomic_inc(v) ((void)(__atomic_add_return( 1,(v))))
#define atomic_dec(v) ((void)(__atomic_add_return( -1,(v))))
-#define atomic_add_return(i,v) (__atomic_add_return( ((int)i),(v)))
-#define atomic_sub_return(i,v) (__atomic_add_return(-((int)i),(v)))
+#define atomic_add_return(i,v) (__atomic_add_return( (i),(v)))
+#define atomic_sub_return(i,v) (__atomic_add_return(-(i),(v)))
#define atomic_inc_return(v) (__atomic_add_return( 1,(v)))
#define atomic_dec_return(v) (__atomic_add_return( -1,(v)))
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH] Remove casts from atomic macros
2009-04-04 20:54 [PATCH] Remove casts from atomic macros Bastian Blank
@ 2009-04-05 2:56 ` Kyle McMartin
2009-04-05 17:04 ` Grant Grundler
2009-04-05 18:42 ` James Bottomley
2 siblings, 0 replies; 4+ messages in thread
From: Kyle McMartin @ 2009-04-05 2:56 UTC (permalink / raw)
To: Bastian Blank, linux-parisc
On Sat, Apr 04, 2009 at 10:54:26PM +0200, Bastian Blank wrote:
> The atomic operations on parisc are defined as macros. The macros
> includes casts which disallows the use of some syntax elements and
> produces error like this:
>
> net/phonet/pep.c: In function 'pipe_rcv_status':
> net/phonet/pep.c:262: error: lvalue required as left operand of assignment
>
> The patch removes this superfluous casts.
>
> Signed-off-by: Bastian Blank <waldi@debian.org>
>
Applied. Thanks.
(Man that phonet thing is stupid code though...)
cheers, Kyle
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Remove casts from atomic macros
2009-04-04 20:54 [PATCH] Remove casts from atomic macros Bastian Blank
2009-04-05 2:56 ` Kyle McMartin
@ 2009-04-05 17:04 ` Grant Grundler
2009-04-05 18:42 ` James Bottomley
2 siblings, 0 replies; 4+ messages in thread
From: Grant Grundler @ 2009-04-05 17:04 UTC (permalink / raw)
To: Bastian Blank, linux-parisc
On Sat, Apr 04, 2009 at 10:54:26PM +0200, Bastian Blank wrote:
> The atomic operations on parisc are defined as macros. The macros
> includes casts which disallows the use of some syntax elements and
> produces error like this:
>
> net/phonet/pep.c: In function 'pipe_rcv_status':
> net/phonet/pep.c:262: error: lvalue required as left operand of assignment
>
> The patch removes this superfluous casts.
Since parisc is "special" for atomic ops, I was worried we would
introduce new warnings into the build because __atomic_add_return()
takes an int as a parameter. No new warnings for my 64-bit build.
thanks,
grant
>
> Signed-off-by: Bastian Blank <waldi@debian.org>
>
> diff --git a/arch/parisc/include/asm/atomic.h b/arch/parisc/include/asm/atomic.h
> index edbfe25..43e101b 100644
> --- a/arch/parisc/include/asm/atomic.h
> +++ b/arch/parisc/include/asm/atomic.h
> @@ -222,13 +222,13 @@ static __inline__ int atomic_add_unless(atomic_t *v, int a, int u)
>
> #define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0)
>
> -#define atomic_add(i,v) ((void)(__atomic_add_return( ((int)i),(v))))
> -#define atomic_sub(i,v) ((void)(__atomic_add_return(-((int)i),(v))))
> +#define atomic_add(i,v) ((void)(__atomic_add_return( (i),(v))))
> +#define atomic_sub(i,v) ((void)(__atomic_add_return(-(i),(v))))
> #define atomic_inc(v) ((void)(__atomic_add_return( 1,(v))))
> #define atomic_dec(v) ((void)(__atomic_add_return( -1,(v))))
>
> -#define atomic_add_return(i,v) (__atomic_add_return( ((int)i),(v)))
> -#define atomic_sub_return(i,v) (__atomic_add_return(-((int)i),(v)))
> +#define atomic_add_return(i,v) (__atomic_add_return( (i),(v)))
> +#define atomic_sub_return(i,v) (__atomic_add_return(-(i),(v)))
> #define atomic_inc_return(v) (__atomic_add_return( 1,(v)))
> #define atomic_dec_return(v) (__atomic_add_return( -1,(v)))
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-parisc" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Remove casts from atomic macros
2009-04-04 20:54 [PATCH] Remove casts from atomic macros Bastian Blank
2009-04-05 2:56 ` Kyle McMartin
2009-04-05 17:04 ` Grant Grundler
@ 2009-04-05 18:42 ` James Bottomley
2 siblings, 0 replies; 4+ messages in thread
From: James Bottomley @ 2009-04-05 18:42 UTC (permalink / raw)
To: Bastian Blank; +Cc: linux-parisc
On Sat, 2009-04-04 at 22:54 +0200, Bastian Blank wrote:
> The atomic operations on parisc are defined as macros. The macros
> includes casts which disallows the use of some syntax elements and
> produces error like this:
>
> net/phonet/pep.c: In function 'pipe_rcv_status':
> net/phonet/pep.c:262: error: lvalue required as left operand of assignment
>
> The patch removes this superfluous casts.
Actually, it's not the casts that are the problem, it's the fact that
they apply to an unbacketed macro argument. The actual fix is here:
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=47e669ce10901dc92960096653d6b22990b5188f
James
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2009-04-05 18:42 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-04-04 20:54 [PATCH] Remove casts from atomic macros Bastian Blank
2009-04-05 2:56 ` Kyle McMartin
2009-04-05 17:04 ` Grant Grundler
2009-04-05 18:42 ` James Bottomley
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.