public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andi Kleen <ak@muc.de>
To: Mathieu Desnoyers <compudj@krystal.dyndns.org>
Cc: vojtech@suse.cz, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] atomic_cmpxchg return type error
Date: 1 Dec 2006 00:23:54 +0100
Date: Fri, 1 Dec 2006 00:23:54 +0100	[thread overview]
Message-ID: <20061130232354.GA12359@muc.de> (raw)
In-Reply-To: <20061130211705.GA12987@Krystal>

On Thu, Nov 30, 2006 at 04:17:06PM -0500, Mathieu Desnoyers wrote:
> Hi,
> 
> I just noticed that a atomic_cmpxchg, that would be given an atomic64_t
> parameter, would cast the return value as a (int). In the typical use of this
> primitive, the result would be that the 32 MSB would be lost when comparing
> against the original value. It also affects atomic_add_unless. Note that there
> is no atomic64_cmpxchg nor atomic64_add_unless, which might make things a
> little clearer.

Normally you're supposed to only use atomic64_* with atomic64_t

While it works for most by accident on x86 to just use atomic_* 
with atomic64_t it's not portable to other architectures.

If you want to use those with atomic64_t suitable macros would need
to be added on all architectures.

-Andi

      reply	other threads:[~2006-11-30 23:23 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-11-30 21:17 [PATCH] atomic_cmpxchg return type error Mathieu Desnoyers
2006-11-30 23:23 ` Andi Kleen [this message]

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=20061130232354.GA12359@muc.de \
    --to=ak@muc.de \
    --cc=compudj@krystal.dyndns.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=vojtech@suse.cz \
    /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