From ab0b03ab236b8a024ca9bd5a948a4dadefedcbe9 Mon Sep 17 00:00:00 2001 From: Frank Mori Hess Date: Mon, 4 Aug 2003 18:30:32 +0000 Subject: [PATCH] fixes for 2.6 module_get/module_put --- include/linux/module.h | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/include/linux/module.h b/include/linux/module.h index 308de36b..9dccf59e 100644 --- a/include/linux/module.h +++ b/include/linux/module.h @@ -7,9 +7,19 @@ #include -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0) -#define __MOD_INC_USE_COUNT(x) -#define __MOD_DEC_USE_COUNT(x) +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) +static inline int try_module_get(struct module *module) +{ + if( module == NULL ) return 1; + __MOD_INC_USE_COUNT( module ); + return 1; +} +static inline void module_put(struct module *module) +{ + if( module == NULL ) return; + __MOD_DEC_USE_COUNT( module ) +} +#else #define MOD_IN_USE (0) #endif -- 2.26.2