Linux PARISC architecture development
 help / color / mirror / Atom feed
From: Grant Grundler <grundler@parisc-linux.org>
To: Bastian Blank <waldi@debian.org>, linux-parisc@vger.kernel.org
Subject: Re: [PATCH] Remove casts from atomic macros
Date: Sun, 5 Apr 2009 11:04:27 -0600	[thread overview]
Message-ID: <20090405170427.GA25876@lackof.org> (raw)
In-Reply-To: <20090404205426.GA27225@wavehammer.waldi.eu.org>

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

  parent reply	other threads:[~2009-04-05 17:04 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2009-04-05 18:42 ` James Bottomley

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090405170427.GA25876@lackof.org \
    --to=grundler@parisc-linux.org \
    --cc=linux-parisc@vger.kernel.org \
    --cc=waldi@debian.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox