Re: [PATCH 20/20] arch: Rewrite generic atomic support

From: Peter Zijlstra
Date: Thu May 08 2014 - 14:26:51 EST


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@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/