[PATCH] Immediate Values - i386 Optimization - kerneldoc

Mathieu Desnoyers
2007-07-15T01:43:16Z

Immediate Values - i386 Optimization - kerneldoc

Add kerneldoc to Immediate Values (i386 Optimization) API.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
CC: hch@infradead.org
---
include/asm-i386/immediate.h | 50 ++++++++++++++++++++++++++++++-------------
1 file changed, 35 insertions(+), 15 deletions(-)

Index: linux-2.6-lttng/include/asm-i386/immediate.h
===================================================================
--- linux-2.6-lttng.orig/include/asm-i386/immediate.h 2007-07-14 20:54:23.000000000 -0400
+++ linux-2.6-lttng/include/asm-i386/immediate.h 2007-07-14 20:54:25.000000000 -0400
@@ -23,13 +23,16 @@ struct __immediate {
long size; /* Type size. */
};

-/*
+/**
+ * immediate_read - read immediate variable
+ * @var: pointer of type immediate_*_t
+ *
+ * Reads the value of @var.
* Optimized version of the immediate.
- * Make sure the 2 and 4 bytes update will be atomic by aligning the immediate
- * value.
- * 2 bytes (short) uses a 66H prefix.
- * If size is bigger than 4 bytes, fall back on a memory read.
* Do not use in __init and __exit functions. Use _immediate_read() instead.
+ * Makes sure the 2 and 4 bytes update will be atomic by aligning the immediate
+ * value. 2 bytes (short) uses a 66H prefix. If size is bigger than 4 bytes,
+ * fall back on a memory read.
*/
#define immediate_read(var) \
({ \
@@ -75,39 +78,56 @@ struct __immediate {
value; \
})

-/*
- * Update immediate value, can take module mutex.
+
+/**
+ * immediate_set - set immediate variable (with locking)
+ * @var: pointer of type immediate_*_t
+ * @i: required value
+ *
+ * Sets the value of @var, taking the module_mutex if required by
+ * the architecture.
*/
#define immediate_set(var, i) \
(var)->value = (i); \
immediate_update(1);

-/*
- * Update immediate value. Module mutex must already be taken.
+/**
+ * _immediate_set - set immediate variable (without locking)
+ * @var: pointer of type immediate_*_t
+ * @i: required value
+ *
+ * Sets the value of @var. Must be called with module_mutex held.
*/
#define _immediate_set(var, i) \
(var)->value = (i); \
immediate_update(0);

-/*
- * Update immediate value at early boot.
+/**
+ * immediate_set_early - set immediate variable at early boot
+ * @var: pointer of type immediate_*_t
+ * @i: required value
+ *
+ * Sets the value of @var. Should be used for early boot updates.
*/
#define immediate_set_early(var, i) \
(var)->value = (i); \
immediate_update_early();

-/*
+/**
+ * immediate_if - if () statement depending on an immediate value
+ * @var: pointer of type immediate_*_t
+ *
+ * Use as an if () statement depending on an immediate value.
+ * Do not use in __init and __exit functions. Use _immediate_if() instead.
* Branch depending on an immediate value. Could eventually be optimized further
* by improving gcc to give the ability to patch a jump instruction instead of
* the value it depends on.
- * Do not use in __init and __exit functions. Use _immediate_if() instead.
*/
#define immediate_if(var) if (unlikely(immediate_read(var)))

/*
- * Used internally.
+ * Internal update functions.
*/
-
extern void immediate_update(int lock);
extern void module_immediate_setup(struct module *mod);
extern void immediate_update_early(void);