Remove casts from atomic macros
Subsystems (2)
PATCH 1/1 Remove casts from atomic macros
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.
arch/parisc/include/asm/atomic.h +4 -4
@@ -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)))
Kyle McMartin
AppliedQuoted 11 lines · Bastian Blank
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 assignmentThe patch removes this superfluous casts.
Signed-off-by Bastian Blank <[email protected]>
Applied. Thanks.
(Man that phonet thing is stupid code though...)
cheers, Kyle
Quoted 8 lines · Bastian Blank
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 assignmentThe 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
Quoted 29 lines
Signed-off-by Bastian Blank <[email protected]>arch/parisc/include/asm/atomic.h +4
-5@@ -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 [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
James Bottomley
maintainerQuoted 8 lines · Bastian Blank
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 assignmentThe 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:
James