drm/via: set FOLL_PIN via pin_user_pages_fast()
[linux-2.6-microblaze.git] / include / asm-generic / export.h
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 #ifndef __ASM_GENERIC_EXPORT_H
3 #define __ASM_GENERIC_EXPORT_H
4
5 #ifndef KSYM_FUNC
6 #define KSYM_FUNC(x) x
7 #endif
8 #ifdef CONFIG_HAVE_ARCH_PREL32_RELOCATIONS
9 #define KSYM_ALIGN 4
10 #elif defined(CONFIG_64BIT)
11 #define KSYM_ALIGN 8
12 #else
13 #define KSYM_ALIGN 4
14 #endif
15 #ifndef KCRC_ALIGN
16 #define KCRC_ALIGN 4
17 #endif
18
19 .macro __put, val, name
20 #ifdef CONFIG_HAVE_ARCH_PREL32_RELOCATIONS
21         .long   \val - ., \name - ., 0
22 #elif defined(CONFIG_64BIT)
23         .quad   \val, \name, 0
24 #else
25         .long   \val, \name, 0
26 #endif
27 .endm
28
29 /*
30  * note on .section use: @progbits vs %progbits nastiness doesn't matter,
31  * since we immediately emit into those sections anyway.
32  */
33 .macro ___EXPORT_SYMBOL name,val,sec
34 #ifdef CONFIG_MODULES
35         .section ___ksymtab\sec+\name,"a"
36         .balign KSYM_ALIGN
37 __ksymtab_\name:
38         __put \val, __kstrtab_\name
39         .previous
40         .section __ksymtab_strings,"a"
41 __kstrtab_\name:
42         .asciz "\name"
43         .previous
44 #ifdef CONFIG_MODVERSIONS
45         .section ___kcrctab\sec+\name,"a"
46         .balign KCRC_ALIGN
47 #if defined(CONFIG_MODULE_REL_CRCS)
48         .long __crc_\name - .
49 #else
50         .long __crc_\name
51 #endif
52         .weak __crc_\name
53         .previous
54 #endif
55 #endif
56 .endm
57
58 #if defined(CONFIG_TRIM_UNUSED_KSYMS)
59
60 #include <linux/kconfig.h>
61 #include <generated/autoksyms.h>
62
63 .macro __ksym_marker sym
64         .section ".discard.ksym","a"
65 __ksym_marker_\sym:
66          .previous
67 .endm
68
69 #define __EXPORT_SYMBOL(sym, val, sec)                          \
70         __ksym_marker sym;                                      \
71         __cond_export_sym(sym, val, sec, __is_defined(__KSYM_##sym))
72 #define __cond_export_sym(sym, val, sec, conf)                  \
73         ___cond_export_sym(sym, val, sec, conf)
74 #define ___cond_export_sym(sym, val, sec, enabled)              \
75         __cond_export_sym_##enabled(sym, val, sec)
76 #define __cond_export_sym_1(sym, val, sec) ___EXPORT_SYMBOL sym, val, sec
77 #define __cond_export_sym_0(sym, val, sec) /* nothing */
78
79 #else
80 #define __EXPORT_SYMBOL(sym, val, sec) ___EXPORT_SYMBOL sym, val, sec
81 #endif
82
83 #define EXPORT_SYMBOL(name)                                     \
84         __EXPORT_SYMBOL(name, KSYM_FUNC(name),)
85 #define EXPORT_SYMBOL_GPL(name)                                 \
86         __EXPORT_SYMBOL(name, KSYM_FUNC(name), _gpl)
87 #define EXPORT_DATA_SYMBOL(name)                                \
88         __EXPORT_SYMBOL(name, name,)
89 #define EXPORT_DATA_SYMBOL_GPL(name)                            \
90         __EXPORT_SYMBOL(name, name,_gpl)
91
92 #endif