[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20140508182642.GL2844@laptop.programming.kicks-ass.net>
Date: Thu, 8 May 2014 20:26:42 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Sam Ravnborg <sam@...nborg.org>
Cc: linux-arch@...r.kernel.org, linux-kernel@...r.kernel.org,
torvalds@...ux-foundation.org, akpm@...ux-foundation.org,
mingo@...nel.org, will.deacon@....com, paulmck@...ux.vnet.ibm.com,
Arnd Bergmann <arnd@...db.de>,
David Howells <dhowells@...hat.com>
Subject: Re: [PATCH 20/20] arch: Rewrite generic atomic support
On Thu, May 08, 2014 at 05:24:01PM +0200, Sam Ravnborg wrote:
> >
> > -/**
> > - * atomic_add_return - add integer to atomic variable
> > - * @i: integer value to add
> > - * @v: pointer of type atomic_t
> > - *
> > - * Atomically adds @i to @v and returns the result
> > - */
> For people not starign at kernel code every days these sparse comments
> is a help. If anything they should be improved rather than deleted.
Does something like this help? Its a bit tedious to have to repeat the
comment while we just collapsed all the implementations.
--- a/include/asm-generic/atomic.h
+++ b/include/asm-generic/atomic.h
@@ -18,6 +18,23 @@
#include <asm/cmpxchg.h>
#include <asm/barrier.h>
+/*
+ * atomic_$op() - $op integer to atomic variable
+ * @i: integer value to $op
+ * @v: pointer to the atomic variable
+ *
+ * Atomically $ops @i to @v. Does not strictly guarantee a memory-barrier, use
+ * smp_mb__{before,after}_atomic().
+ */
+
+/*
+ * atomic_$op_return() - $op interer to atomic variable and returns the result
+ * @i: integer value to $op
+ * @v: pointer to the atomic variable
+ *
+ * Atomically $ops @i to @v. Does imply a full memory barrier.
+ */
+
#ifdef CONFIG_SMP
/* we can build all atomic primitives from cmpxchg */
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists