All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Perez-Gonzalez, Inaky" <inaky.perez-gonzalez@intel.com>
To: "sankar" <san_madhav@hotmail.com>, "Tim Hockin" <thockin@hockin.org>
Cc: <linux-kernel@vger.kernel.org>
Subject: RE: Question on atomic_inc/dec
Date: Wed, 15 Oct 2003 10:38:14 -0700	[thread overview]
Message-ID: <A20D5638D741DD4DBAAB80A95012C0AED7868F@orsmsx409.jf.intel.com> (raw)

> From: sankar [mailto:san_madhav@hotmail.com]

>  any solution to the original problem???
> (atomic_inc() defintion not there in redhat 9.0 asm/atomic.h)

Create an atomic.h header file in your source tree with the code
below, but bear in mind that porting to other arches might be painful:

struct atomic
{
  volatile int i;
}

  /* Simple atomic increment. */

static inline
void atomic_inc (struct atomic *a)
{
    asm volatile (
      "lock; incl %0"
      : "=m" (a->i)
      : "m" (a->i));
}

  /* Simple atomic decrement. */

static inline
void atomic_dec (struct atomic *a)
{
    asm volatile (
      "lock; decl %0"
      : "=m" (a->i)
      : "m" (a->i));
}

Iñaky Pérez-González -- Not speaking for Intel -- all opinions are my own (and my fault)


             reply	other threads:[~2003-10-15 17:38 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-10-15 17:38 Perez-Gonzalez, Inaky [this message]
2003-10-15 18:02 ` [OT] Question on atomic_inc/dec Petr Vandrovec
  -- strict thread matches above, loose matches on Subject: below --
2003-10-14 22:29 Perez-Gonzalez, Inaky
2003-10-15 17:28 ` sankar
2003-10-14 21:17 Perez-Gonzalez, Inaky
2003-10-14 21:34 ` sankar
2003-10-14 21:44 ` Tim Hockin
2003-10-14 22:35   ` David S. Miller
2003-10-15  7:57   ` Arjan van de Ven
2003-10-14 18:38 sankar

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=A20D5638D741DD4DBAAB80A95012C0AED7868F@orsmsx409.jf.intel.com \
    --to=inaky.perez-gonzalez@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=san_madhav@hotmail.com \
    --cc=thockin@hockin.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 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.