aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Gortmaker <paul.gortmaker@windriver.com>2016-07-26 22:36:34 -0400
committerRusty Russell <rusty@rustcorp.com.au>2016-08-03 20:46:54 -0400
commit0ef7653797addea8ba1bf97f8208a54a62498d94 (patch)
tree655979c9db03954e99b6dbde23c887e09140ee75
parentbe7de5f91fdc3a63ee01910c43f20db213445ce4 (diff)
exceptions: fork exception table content from module.h into extable.h
For historical reasons (i.e. pre-git) the exception table stuff was buried in the middle of the module.h file. I noticed this while doing an audit for needless includes of module.h and found core kernel files (both arch specific and arch independent) were just including module.h for this. The converse is also true, in that conventional drivers, be they for filesystems or actual hardware peripherals or similar, do not normally care about the exception tables. Here we fork the exception table content out of module.h into a new file called extable.h -- and temporarily include it into the module.h itself. Then we will work our way across the arch independent and arch specific files needing just exception table content, and move them off module.h and onto extable.h Once that is done, we can remove the extable.h from module.h and in doing it like this, we avoid introducing build failures into the git history. The gain here is that module.h gets a bit smaller, across all modular drivers that we build for allmodconfig. Also the core files that only need exception table stuff don't have an include of module.h that brings in lots of extra stuff and just looks generally out of place. Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
-rw-r--r--include/linux/extable.h30
-rw-r--r--include/linux/module.h27
2 files changed, 32 insertions, 25 deletions
diff --git a/include/linux/extable.h b/include/linux/extable.h
new file mode 100644
index 000000000000..2c71dccd1bc3
--- /dev/null
+++ b/include/linux/extable.h
@@ -0,0 +1,30 @@
1#ifndef _LINUX_EXTABLE_H
2#define _LINUX_EXTABLE_H
3
4struct module;
5struct exception_table_entry;
6
7const struct exception_table_entry *
8search_extable(const struct exception_table_entry *first,
9 const struct exception_table_entry *last,
10 unsigned long value);
11void sort_extable(struct exception_table_entry *start,
12 struct exception_table_entry *finish);
13void sort_main_extable(void);
14void trim_init_extable(struct module *m);
15
16/* Given an address, look for it in the exception tables */
17const struct exception_table_entry *search_exception_tables(unsigned long add);
18
19#ifdef CONFIG_MODULES
20/* For extable.c to search modules' exception tables. */
21const struct exception_table_entry *search_module_extables(unsigned long addr);
22#else
23static inline const struct exception_table_entry *
24search_module_extables(unsigned long addr)
25{
26 return NULL;
27}
28#endif /*CONFIG_MODULES*/
29
30#endif /* _LINUX_EXTABLE_H */
diff --git a/include/linux/module.h b/include/linux/module.h
index f777164c238b..f95ed243a4de 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -18,6 +18,7 @@
18#include <linux/moduleparam.h> 18#include <linux/moduleparam.h>
19#include <linux/jump_label.h> 19#include <linux/jump_label.h>
20#include <linux/export.h> 20#include <linux/export.h>
21#include <linux/extable.h> /* only as arch move module.h -> extable.h */
21#include <linux/rbtree_latch.h> 22#include <linux/rbtree_latch.h>
22 23
23#include <linux/percpu.h> 24#include <linux/percpu.h>
@@ -37,6 +38,7 @@ struct modversion_info {
37}; 38};
38 39
39struct module; 40struct module;
41struct exception_table_entry;
40 42
41struct module_kobject { 43struct module_kobject {
42 struct kobject kobj; 44 struct kobject kobj;
@@ -155,18 +157,6 @@ extern void cleanup_module(void);
155#define __INITRODATA_OR_MODULE __INITRODATA 157#define __INITRODATA_OR_MODULE __INITRODATA
156#endif /*CONFIG_MODULES*/ 158#endif /*CONFIG_MODULES*/
157 159
158/* Archs provide a method of finding the correct exception table. */
159struct exception_table_entry;
160
161const struct exception_table_entry *
162search_extable(const struct exception_table_entry *first,
163 const struct exception_table_entry *last,
164 unsigned long value);
165void sort_extable(struct exception_table_entry *start,
166 struct exception_table_entry *finish);
167void sort_main_extable(void);
168void trim_init_extable(struct module *m);
169
170/* Generic info of form tag = "info" */ 160/* Generic info of form tag = "info" */
171#define MODULE_INFO(tag, info) __MODULE_INFO(tag, tag, info) 161#define MODULE_INFO(tag, info) __MODULE_INFO(tag, tag, info)
172 162
@@ -268,9 +258,6 @@ extern const typeof(name) __mod_##type##__##name##_device_table \
268 * files require multiple MODULE_FIRMWARE() specifiers */ 258 * files require multiple MODULE_FIRMWARE() specifiers */
269#define MODULE_FIRMWARE(_firmware) MODULE_INFO(firmware, _firmware) 259#define MODULE_FIRMWARE(_firmware) MODULE_INFO(firmware, _firmware)
270 260
271/* Given an address, look for it in the exception tables */
272const struct exception_table_entry *search_exception_tables(unsigned long add);
273
274struct notifier_block; 261struct notifier_block;
275 262
276#ifdef CONFIG_MODULES 263#ifdef CONFIG_MODULES
@@ -630,9 +617,6 @@ const char *module_address_lookup(unsigned long addr,
630int lookup_module_symbol_name(unsigned long addr, char *symname); 617int lookup_module_symbol_name(unsigned long addr, char *symname);
631int lookup_module_symbol_attrs(unsigned long addr, unsigned long *size, unsigned long *offset, char *modname, char *name); 618int lookup_module_symbol_attrs(unsigned long addr, unsigned long *size, unsigned long *offset, char *modname, char *name);
632 619
633/* For extable.c to search modules' exception tables. */
634const struct exception_table_entry *search_module_extables(unsigned long addr);
635
636int register_module_notifier(struct notifier_block *nb); 620int register_module_notifier(struct notifier_block *nb);
637int unregister_module_notifier(struct notifier_block *nb); 621int unregister_module_notifier(struct notifier_block *nb);
638 622
@@ -657,13 +641,6 @@ static inline bool is_livepatch_module(struct module *mod)
657 641
658#else /* !CONFIG_MODULES... */ 642#else /* !CONFIG_MODULES... */
659 643
660/* Given an address, look for it in the exception tables. */
661static inline const struct exception_table_entry *
662search_module_extables(unsigned long addr)
663{
664 return NULL;
665}
666
667static inline struct module *__module_address(unsigned long addr) 644static inline struct module *__module_address(unsigned long addr)
668{ 645{
669 return NULL; 646 return NULL;