diff options
-rw-r--r-- | backport/backport-include/linux/compiler.h | 11 | ||||
-rw-r--r-- | backport/backport-include/linux/moduleparam.h | 14 |
2 files changed, 25 insertions, 0 deletions
diff --git a/backport/backport-include/linux/compiler.h b/backport/backport-include/linux/compiler.h index 0f5dfe48..613b857a 100644 --- a/backport/backport-include/linux/compiler.h +++ b/backport/backport-include/linux/compiler.h @@ -14,4 +14,15 @@ #endif #endif +#ifndef __PASTE +/* Indirect macros required for expanded argument pasting, eg. __LINE__. */ +#define ___PASTE(a,b) a##b +#define __PASTE(a,b) ___PASTE(a,b) +#endif + +/* Not-quite-unique ID. */ +#ifndef __UNIQUE_ID +# define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __LINE__) +#endif + #endif /* __BACKPORT_LINUX_COMPILER_H */ diff --git a/backport/backport-include/linux/moduleparam.h b/backport/backport-include/linux/moduleparam.h index a156b895..624aacde 100644 --- a/backport/backport-include/linux/moduleparam.h +++ b/backport/backport-include/linux/moduleparam.h @@ -15,4 +15,18 @@ static inline void kernel_param_unlock(struct module *mod) } #endif +#if LINUX_VERSION_CODE < KERNEL_VERSION(3,8,0) +#undef __MODULE_INFO +#ifdef MODULE +#define __MODULE_INFO(tag, name, info) \ +static const char __UNIQUE_ID(name)[] \ + __used __attribute__((section(".modinfo"), unused, aligned(1))) \ + = __stringify(tag) "=" info +#else /* !MODULE */ +/* This struct is here for syntactic coherency, it is not used */ +#define __MODULE_INFO(tag, name, info) \ + struct __UNIQUE_ID(name) {} +#endif +#endif /* < 3.8 */ + #endif /* __BACKPORT_LINUX_MODULEPARAM_H */ |