summaryrefslogtreecommitdiffstats
path: root/include/linux/module.h
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>1999-02-15 02:15:32 +0000
committerRalf Baechle <ralf@linux-mips.org>1999-02-15 02:15:32 +0000
commit86464aed71025541805e7b1515541aee89879e33 (patch)
treee01a457a4912a8553bc65524aa3125d51f29f810 /include/linux/module.h
parent88f99939ecc6a95a79614574cb7d95ffccfc3466 (diff)
Merge with Linux 2.2.1.
Diffstat (limited to 'include/linux/module.h')
-rw-r--r--include/linux/module.h24
1 files changed, 15 insertions, 9 deletions
diff --git a/include/linux/module.h b/include/linux/module.h
index ad3d10baf..94cce874f 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -20,6 +20,7 @@
# endif
#endif /* __GENKSYMS__ */
+#include <asm/atomic.h>
/* Don't need to bring in all of uaccess.h just for this decl. */
struct exception_table_entry;
@@ -54,7 +55,12 @@ struct module
const char *name;
unsigned long size;
- long usecount;
+ union
+ {
+ atomic_t usecount;
+ long pad;
+ } uc; /* Needs to keep its size - so says rth */
+
unsigned long flags; /* AUTOCLEAN et al */
unsigned nsyms;
@@ -80,10 +86,10 @@ struct module
struct module_info
{
- unsigned long addr;
- unsigned long size;
- unsigned long flags;
- long usecount;
+ unsigned long addr;
+ unsigned long size;
+ unsigned long flags;
+ long usecount;
};
/* Bits of module.flags. */
@@ -114,17 +120,17 @@ struct module_info
/* Backwards compatibility definition. */
-#define GET_USE_COUNT(module) ((module)->usecount)
+#define GET_USE_COUNT(module) (atomic_read(&(module)->uc.usecount))
/* Poke the use count of a module. */
#define __MOD_INC_USE_COUNT(mod) \
- ((mod)->usecount++, (mod)->flags |= MOD_VISITED|MOD_USED_ONCE)
+ (atomic_inc(&(mod)->uc.usecount), (mod)->flags |= MOD_VISITED|MOD_USED_ONCE)
#define __MOD_DEC_USE_COUNT(mod) \
- ((mod)->usecount--, (mod)->flags |= MOD_VISITED)
+ (atomic_dec(&(mod)->uc.usecount), (mod)->flags |= MOD_VISITED)
#define __MOD_IN_USE(mod) \
(mod_member_present((mod), can_unload) && (mod)->can_unload \
- ? (mod)->can_unload() : (mod)->usecount)
+ ? (mod)->can_unload() : atomic_read(&(mod)->uc.usecount))
/* Indirect stringification. */