OMAPDSS: VENC: fix NULL pointer dereference in DSS2 VENC sysfs debug attr on OMAP4
[zen-stable.git] / include / linux / export.h
blob696c0f48afc71716f00477ac5a0412804845a66e
1 #ifndef _LINUX_EXPORT_H
2 #define _LINUX_EXPORT_H
3 /*
4 * Export symbols from the kernel to modules. Forked from module.h
5 * to reduce the amount of pointless cruft we feed to gcc when only
6 * exporting a simple symbol or two.
8 * If you feel the need to add #include <linux/foo.h> to this file
9 * then you are doing something wrong and should go away silently.
12 /* Some toolchains use a `_' prefix for all user symbols. */
13 #ifdef CONFIG_SYMBOL_PREFIX
14 #define MODULE_SYMBOL_PREFIX CONFIG_SYMBOL_PREFIX
15 #else
16 #define MODULE_SYMBOL_PREFIX ""
17 #endif
19 struct kernel_symbol
21 unsigned long value;
22 const char *name;
25 #ifdef MODULE
26 extern struct module __this_module;
27 #define THIS_MODULE (&__this_module)
28 #else
29 #define THIS_MODULE ((struct module *)0)
30 #endif
32 #ifdef CONFIG_MODULES
34 #ifndef __GENKSYMS__
35 #ifdef CONFIG_MODVERSIONS
36 /* Mark the CRC weak since genksyms apparently decides not to
37 * generate a checksums for some symbols */
38 #define __CRC_SYMBOL(sym, sec) \
39 extern void *__crc_##sym __attribute__((weak)); \
40 static const unsigned long __kcrctab_##sym \
41 __used \
42 __attribute__((section("___kcrctab" sec "+" #sym), unused)) \
43 = (unsigned long) &__crc_##sym;
44 #else
45 #define __CRC_SYMBOL(sym, sec)
46 #endif
48 /* For every exported symbol, place a struct in the __ksymtab section */
49 #define __EXPORT_SYMBOL(sym, sec) \
50 extern typeof(sym) sym; \
51 __CRC_SYMBOL(sym, sec) \
52 static const char __kstrtab_##sym[] \
53 __attribute__((section("__ksymtab_strings"), aligned(1))) \
54 = MODULE_SYMBOL_PREFIX #sym; \
55 static const struct kernel_symbol __ksymtab_##sym \
56 __used \
57 __attribute__((section("___ksymtab" sec "+" #sym), unused)) \
58 = { (unsigned long)&sym, __kstrtab_##sym }
60 #define EXPORT_SYMBOL(sym) \
61 __EXPORT_SYMBOL(sym, "")
63 #define EXPORT_SYMBOL_GPL(sym) \
64 __EXPORT_SYMBOL(sym, "_gpl")
66 #define EXPORT_SYMBOL_GPL_FUTURE(sym) \
67 __EXPORT_SYMBOL(sym, "_gpl_future")
69 #ifdef CONFIG_UNUSED_SYMBOLS
70 #define EXPORT_UNUSED_SYMBOL(sym) __EXPORT_SYMBOL(sym, "_unused")
71 #define EXPORT_UNUSED_SYMBOL_GPL(sym) __EXPORT_SYMBOL(sym, "_unused_gpl")
72 #else
73 #define EXPORT_UNUSED_SYMBOL(sym)
74 #define EXPORT_UNUSED_SYMBOL_GPL(sym)
75 #endif
77 #endif /* __GENKSYMS__ */
79 #else /* !CONFIG_MODULES... */
81 #define EXPORT_SYMBOL(sym)
82 #define EXPORT_SYMBOL_GPL(sym)
83 #define EXPORT_SYMBOL_GPL_FUTURE(sym)
84 #define EXPORT_UNUSED_SYMBOL(sym)
85 #define EXPORT_UNUSED_SYMBOL_GPL(sym)
87 #endif /* CONFIG_MODULES */
89 #endif /* _LINUX_EXPORT_H */