aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2009-03-31 15:05:31 -0400
committerRusty Russell <rusty@rustcorp.com.au>2009-03-30 22:35:32 -0400
commita6e6abd575fcbe6572ebc7a70ad616406d206fa8 (patch)
tree3909d2be063116936179bb4da85d5cb4aed32ce6 /kernel
parente610499e2656e61975affd0af56b26eb73964c84 (diff)
module: remove module_text_address()
Impact: Replace and remove risky (non-EXPORTed) API module_text_address() returns a pointer to the module, which given locking improvements in module.c, is useless except to test for NULL: 1) If the module can't go away, use __module_text_address. 2) Otherwise, just use is_module_text_address(). Cc: linux-mtd@lists.infradead.org Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/extable.c6
-rw-r--r--kernel/module.c17
2 files changed, 7 insertions, 16 deletions
diff --git a/kernel/extable.c b/kernel/extable.c
index e136ed8d82ba..384f0da8a03e 100644
--- a/kernel/extable.c
+++ b/kernel/extable.c
@@ -58,14 +58,14 @@ __notrace_funcgraph int __kernel_text_address(unsigned long addr)
58{ 58{
59 if (core_kernel_text(addr)) 59 if (core_kernel_text(addr))
60 return 1; 60 return 1;
61 return __module_text_address(addr) != NULL; 61 return is_module_text_address(addr);
62} 62}
63 63
64int kernel_text_address(unsigned long addr) 64int kernel_text_address(unsigned long addr)
65{ 65{
66 if (core_kernel_text(addr)) 66 if (core_kernel_text(addr))
67 return 1; 67 return 1;
68 return module_text_address(addr) != NULL; 68 return is_module_text_address(addr);
69} 69}
70 70
71/* 71/*
@@ -81,5 +81,5 @@ int func_ptr_is_kernel_text(void *ptr)
81 addr = (unsigned long) dereference_function_descriptor(ptr); 81 addr = (unsigned long) dereference_function_descriptor(ptr);
82 if (core_kernel_text(addr)) 82 if (core_kernel_text(addr))
83 return 1; 83 return 1;
84 return module_text_address(addr) != NULL; 84 return is_module_text_address(addr);
85} 85}
diff --git a/kernel/module.c b/kernel/module.c
index bd15a94f91c1..8ddca629e079 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -908,8 +908,10 @@ void symbol_put_addr(void *addr)
908 if (core_kernel_text((unsigned long)addr)) 908 if (core_kernel_text((unsigned long)addr))
909 return; 909 return;
910 910
911 if (!(modaddr = module_text_address((unsigned long)addr))) 911 /* module_text_address is safe here: we're supposed to have reference
912 BUG(); 912 * to module from symbol_get, so it can't go away. */
913 modaddr = __module_text_address((unsigned long)addr);
914 BUG_ON(!modaddr);
913 module_put(modaddr); 915 module_put(modaddr);
914} 916}
915EXPORT_SYMBOL_GPL(symbol_put_addr); 917EXPORT_SYMBOL_GPL(symbol_put_addr);
@@ -2821,17 +2823,6 @@ struct module *__module_text_address(unsigned long addr)
2821 return mod; 2823 return mod;
2822} 2824}
2823 2825
2824struct module *module_text_address(unsigned long addr)
2825{
2826 struct module *mod;
2827
2828 preempt_disable();
2829 mod = __module_text_address(addr);
2830 preempt_enable();
2831
2832 return mod;
2833}
2834
2835/* Don't grab lock, we're oopsing. */ 2826/* Don't grab lock, we're oopsing. */
2836void print_modules(void) 2827void print_modules(void)
2837{ 2828{