mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* RE: Question on atomic_inc/dec
@ 2003-10-15 17:38 Perez-Gonzalez, Inaky
  2003-10-15 18:02 ` [OT] " Petr Vandrovec
  0 siblings, 1 reply; 2+ messages in thread
From: Perez-Gonzalez, Inaky @ 2003-10-15 17:38 UTC (permalink / raw)
  To: sankar, Tim Hockin; +Cc: linux-kernel

> 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)


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-10-15 18:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-10-15 17:38 Question on atomic_inc/dec Perez-Gonzalez, Inaky
2003-10-15 18:02 ` [OT] " Petr Vandrovec

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®