From: Frank Mori Hess Date: Mon, 4 Aug 2003 18:30:32 +0000 (+0000) Subject: fixes for 2.6 module_get/module_put X-Git-Tag: r0_7_69~292 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=ab0b03ab236b8a024ca9bd5a948a4dadefedcbe9;p=comedi.git fixes for 2.6 module_get/module_put --- 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