Commit bddb12b3 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

kernel/module.c: use pr_foo()

kernel/module.c uses a mix of printk(KERN_foo and pr_foo().  Convert it
all to pr_foo and make the offered cleanups.

Not sure what to do about the printk(KERN_DEFAULT).  We don't have a
pr_default().

Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: Joe Perches <joe@perches.com>
Cc: Frantisek Hrbata <fhrbata@redhat.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 17c568d6
...@@ -378,23 +378,21 @@ static bool check_symbol(const struct symsearch *syms, ...@@ -378,23 +378,21 @@ static bool check_symbol(const struct symsearch *syms,
if (syms->licence == GPL_ONLY) if (syms->licence == GPL_ONLY)
return false; return false;
if (syms->licence == WILL_BE_GPL_ONLY && fsa->warn) { if (syms->licence == WILL_BE_GPL_ONLY && fsa->warn) {
printk(KERN_WARNING "Symbol %s is being used " pr_warn("Symbol %s is being used by a non-GPL module, "
"by a non-GPL module, which will not " "which will not be allowed in the future\n",
"be allowed in the future\n", fsa->name); fsa->name);
} }
} }
#ifdef CONFIG_UNUSED_SYMBOLS #ifdef CONFIG_UNUSED_SYMBOLS
if (syms->unused && fsa->warn) { if (syms->unused && fsa->warn) {
printk(KERN_WARNING "Symbol %s is marked as UNUSED, " pr_warn("Symbol %s is marked as UNUSED, however this module is "
"however this module is using it.\n", fsa->name); "using it.\n", fsa->name);
printk(KERN_WARNING pr_warn("This symbol will go away in the future.\n");
"This symbol will go away in the future.\n"); pr_warn("Please evalute if this is the right api to use and if "
printk(KERN_WARNING "it really is, submit a report the linux kernel "
"Please evalute if this is the right api to use and if " "mailinglist together with submitting your code for "
"it really is, submit a report the linux kernel " "inclusion.\n");
"mailinglist together with submitting your code for "
"inclusion.\n");
} }
#endif #endif
...@@ -492,16 +490,15 @@ static int percpu_modalloc(struct module *mod, struct load_info *info) ...@@ -492,16 +490,15 @@ static int percpu_modalloc(struct module *mod, struct load_info *info)
return 0; return 0;
if (align > PAGE_SIZE) { if (align > PAGE_SIZE) {
printk(KERN_WARNING "%s: per-cpu alignment %li > %li\n", pr_warn("%s: per-cpu alignment %li > %li\n",
mod->name, align, PAGE_SIZE); mod->name, align, PAGE_SIZE);
align = PAGE_SIZE; align = PAGE_SIZE;
} }
mod->percpu = __alloc_reserved_percpu(pcpusec->sh_size, align); mod->percpu = __alloc_reserved_percpu(pcpusec->sh_size, align);
if (!mod->percpu) { if (!mod->percpu) {
printk(KERN_WARNING pr_warn("%s: Could not allocate %lu bytes percpu data\n",
"%s: Could not allocate %lu bytes percpu data\n", mod->name, (unsigned long)pcpusec->sh_size);
mod->name, (unsigned long)pcpusec->sh_size);
return -ENOMEM; return -ENOMEM;
} }
mod->percpu_size = pcpusec->sh_size; mod->percpu_size = pcpusec->sh_size;
...@@ -679,7 +676,7 @@ static int add_module_usage(struct module *a, struct module *b) ...@@ -679,7 +676,7 @@ static int add_module_usage(struct module *a, struct module *b)
pr_debug("Allocating new usage for %s.\n", a->name); pr_debug("Allocating new usage for %s.\n", a->name);
use = kmalloc(sizeof(*use), GFP_ATOMIC); use = kmalloc(sizeof(*use), GFP_ATOMIC);
if (!use) { if (!use) {
printk(KERN_WARNING "%s: out of memory loading\n", a->name); pr_warn("%s: out of memory loading\n", a->name);
return -ENOMEM; return -ENOMEM;
} }
...@@ -1145,8 +1142,7 @@ static int try_to_force_load(struct module *mod, const char *reason) ...@@ -1145,8 +1142,7 @@ static int try_to_force_load(struct module *mod, const char *reason)
{ {
#ifdef CONFIG_MODULE_FORCE_LOAD #ifdef CONFIG_MODULE_FORCE_LOAD
if (!test_taint(TAINT_FORCED_MODULE)) if (!test_taint(TAINT_FORCED_MODULE))
printk(KERN_WARNING "%s: %s: kernel tainted.\n", pr_warn("%s: %s: kernel tainted.\n", mod->name, reason);
mod->name, reason);
add_taint_module(mod, TAINT_FORCED_MODULE, LOCKDEP_NOW_UNRELIABLE); add_taint_module(mod, TAINT_FORCED_MODULE, LOCKDEP_NOW_UNRELIABLE);
return 0; return 0;
#else #else
...@@ -1199,8 +1195,7 @@ static int check_version(Elf_Shdr *sechdrs, ...@@ -1199,8 +1195,7 @@ static int check_version(Elf_Shdr *sechdrs,
goto bad_version; goto bad_version;
} }
printk(KERN_WARNING "%s: no symbol version for %s\n", pr_warn("%s: no symbol version for %s\n", mod->name, symname);
mod->name, symname);
return 0; return 0;
bad_version: bad_version:
...@@ -1309,8 +1304,8 @@ resolve_symbol_wait(struct module *mod, ...@@ -1309,8 +1304,8 @@ resolve_symbol_wait(struct module *mod,
!IS_ERR(ksym = resolve_symbol(mod, info, name, owner)) !IS_ERR(ksym = resolve_symbol(mod, info, name, owner))
|| PTR_ERR(ksym) != -EBUSY, || PTR_ERR(ksym) != -EBUSY,
30 * HZ) <= 0) { 30 * HZ) <= 0) {
printk(KERN_WARNING "%s: gave up waiting for init of module %s.\n", pr_warn("%s: gave up waiting for init of module %s.\n",
mod->name, owner); mod->name, owner);
} }
return ksym; return ksym;
} }
...@@ -1626,15 +1621,14 @@ static int mod_sysfs_init(struct module *mod) ...@@ -1626,15 +1621,14 @@ static int mod_sysfs_init(struct module *mod)
struct kobject *kobj; struct kobject *kobj;
if (!module_sysfs_initialized) { if (!module_sysfs_initialized) {
printk(KERN_ERR "%s: module sysfs not initialized\n", pr_err("%s: module sysfs not initialized\n", mod->name);
mod->name);
err = -EINVAL; err = -EINVAL;
goto out; goto out;
} }
kobj = kset_find_obj(module_kset, mod->name); kobj = kset_find_obj(module_kset, mod->name);
if (kobj) { if (kobj) {
printk(KERN_ERR "%s: module is already loaded\n", mod->name); pr_err("%s: module is already loaded\n", mod->name);
kobject_put(kobj); kobject_put(kobj);
err = -EINVAL; err = -EINVAL;
goto out; goto out;
...@@ -1961,8 +1955,7 @@ static int verify_export_symbols(struct module *mod) ...@@ -1961,8 +1955,7 @@ static int verify_export_symbols(struct module *mod)
for (i = 0; i < ARRAY_SIZE(arr); i++) { for (i = 0; i < ARRAY_SIZE(arr); i++) {
for (s = arr[i].sym; s < arr[i].sym + arr[i].num; s++) { for (s = arr[i].sym; s < arr[i].sym + arr[i].num; s++) {
if (find_symbol(s->name, &owner, NULL, true, false)) { if (find_symbol(s->name, &owner, NULL, true, false)) {
printk(KERN_ERR pr_err("%s: exports duplicate symbol %s"
"%s: exports duplicate symbol %s"
" (owned by %s)\n", " (owned by %s)\n",
mod->name, s->name, module_name(owner)); mod->name, s->name, module_name(owner));
return -ENOEXEC; return -ENOEXEC;
...@@ -2013,8 +2006,8 @@ static int simplify_symbols(struct module *mod, const struct load_info *info) ...@@ -2013,8 +2006,8 @@ static int simplify_symbols(struct module *mod, const struct load_info *info)
if (!ksym && ELF_ST_BIND(sym[i].st_info) == STB_WEAK) if (!ksym && ELF_ST_BIND(sym[i].st_info) == STB_WEAK)
break; break;
printk(KERN_WARNING "%s: Unknown symbol %s (err %li)\n", pr_warn("%s: Unknown symbol %s (err %li)\n",
mod->name, name, PTR_ERR(ksym)); mod->name, name, PTR_ERR(ksym));
ret = PTR_ERR(ksym) ?: -ENOENT; ret = PTR_ERR(ksym) ?: -ENOENT;
break; break;
...@@ -2168,8 +2161,8 @@ static void set_license(struct module *mod, const char *license) ...@@ -2168,8 +2161,8 @@ static void set_license(struct module *mod, const char *license)
if (!license_is_gpl_compatible(license)) { if (!license_is_gpl_compatible(license)) {
if (!test_taint(TAINT_PROPRIETARY_MODULE)) if (!test_taint(TAINT_PROPRIETARY_MODULE))
printk(KERN_WARNING "%s: module license '%s' taints " pr_warn("%s: module license '%s' taints kernel.\n",
"kernel.\n", mod->name, license); mod->name, license);
add_taint_module(mod, TAINT_PROPRIETARY_MODULE, add_taint_module(mod, TAINT_PROPRIETARY_MODULE,
LOCKDEP_NOW_UNRELIABLE); LOCKDEP_NOW_UNRELIABLE);
} }
...@@ -2405,8 +2398,8 @@ static void dynamic_debug_setup(struct _ddebug *debug, unsigned int num) ...@@ -2405,8 +2398,8 @@ static void dynamic_debug_setup(struct _ddebug *debug, unsigned int num)
return; return;
#ifdef CONFIG_DYNAMIC_DEBUG #ifdef CONFIG_DYNAMIC_DEBUG
if (ddebug_add_module(debug, num, debug->modname)) if (ddebug_add_module(debug, num, debug->modname))
printk(KERN_ERR "dynamic debug error adding module: %s\n", pr_err("dynamic debug error adding module: %s\n",
debug->modname); debug->modname);
#endif #endif
} }
...@@ -2619,8 +2612,7 @@ static int rewrite_section_headers(struct load_info *info, int flags) ...@@ -2619,8 +2612,7 @@ static int rewrite_section_headers(struct load_info *info, int flags)
Elf_Shdr *shdr = &info->sechdrs[i]; Elf_Shdr *shdr = &info->sechdrs[i];
if (shdr->sh_type != SHT_NOBITS if (shdr->sh_type != SHT_NOBITS
&& info->len < shdr->sh_offset + shdr->sh_size) { && info->len < shdr->sh_offset + shdr->sh_size) {
printk(KERN_ERR "Module len %lu truncated\n", pr_err("Module len %lu truncated\n", info->len);
info->len);
return -ENOEXEC; return -ENOEXEC;
} }
...@@ -2682,15 +2674,14 @@ static struct module *setup_load_info(struct load_info *info, int flags) ...@@ -2682,15 +2674,14 @@ static struct module *setup_load_info(struct load_info *info, int flags)
info->index.mod = find_sec(info, ".gnu.linkonce.this_module"); info->index.mod = find_sec(info, ".gnu.linkonce.this_module");
if (!info->index.mod) { if (!info->index.mod) {
printk(KERN_WARNING "No module found in object\n"); pr_warn("No module found in object\n");
return ERR_PTR(-ENOEXEC); return ERR_PTR(-ENOEXEC);
} }
/* This is temporary: point mod into copy of data. */ /* This is temporary: point mod into copy of data. */
mod = (void *)info->sechdrs[info->index.mod].sh_addr; mod = (void *)info->sechdrs[info->index.mod].sh_addr;
if (info->index.sym == 0) { if (info->index.sym == 0) {
printk(KERN_WARNING "%s: module has no symbols (stripped?)\n", pr_warn("%s: module has no symbols (stripped?)\n", mod->name);
mod->name);
return ERR_PTR(-ENOEXEC); return ERR_PTR(-ENOEXEC);
} }
...@@ -2717,7 +2708,7 @@ static int check_modinfo(struct module *mod, struct load_info *info, int flags) ...@@ -2717,7 +2708,7 @@ static int check_modinfo(struct module *mod, struct load_info *info, int flags)
if (err) if (err)
return err; return err;
} else if (!same_magic(modmagic, vermagic, info->index.vers)) { } else if (!same_magic(modmagic, vermagic, info->index.vers)) {
printk(KERN_ERR "%s: version magic '%s' should be '%s'\n", pr_err("%s: version magic '%s' should be '%s'\n",
mod->name, modmagic, vermagic); mod->name, modmagic, vermagic);
return -ENOEXEC; return -ENOEXEC;
} }
...@@ -2727,9 +2718,8 @@ static int check_modinfo(struct module *mod, struct load_info *info, int flags) ...@@ -2727,9 +2718,8 @@ static int check_modinfo(struct module *mod, struct load_info *info, int flags)
if (get_modinfo(info, "staging")) { if (get_modinfo(info, "staging")) {
add_taint_module(mod, TAINT_CRAP, LOCKDEP_STILL_OK); add_taint_module(mod, TAINT_CRAP, LOCKDEP_STILL_OK);
printk(KERN_WARNING "%s: module is from the staging directory," pr_warn("%s: module is from the staging directory, the quality "
" the quality is unknown, you have been warned.\n", "is unknown, you have been warned.\n", mod->name);
mod->name);
} }
/* Set up license info based on the info section */ /* Set up license info based on the info section */
...@@ -2801,8 +2791,7 @@ static void find_module_sections(struct module *mod, struct load_info *info) ...@@ -2801,8 +2791,7 @@ static void find_module_sections(struct module *mod, struct load_info *info)
sizeof(*mod->extable), &mod->num_exentries); sizeof(*mod->extable), &mod->num_exentries);
if (section_addr(info, "__obsparm")) if (section_addr(info, "__obsparm"))
printk(KERN_WARNING "%s: Ignoring obsolete parameters\n", pr_warn("%s: Ignoring obsolete parameters\n", mod->name);
mod->name);
info->debug = section_objs(info, "__verbose", info->debug = section_objs(info, "__verbose",
sizeof(*info->debug), &info->num_debug); sizeof(*info->debug), &info->num_debug);
...@@ -3078,11 +3067,10 @@ static int do_init_module(struct module *mod) ...@@ -3078,11 +3067,10 @@ static int do_init_module(struct module *mod)
return ret; return ret;
} }
if (ret > 0) { if (ret > 0) {
printk(KERN_WARNING pr_warn("%s: '%s'->init suspiciously returned %d, it should "
"%s: '%s'->init suspiciously returned %d, it should follow 0/-E convention\n" "follow 0/-E convention\n"
"%s: loading module anyway...\n", "%s: loading module anyway...\n",
__func__, mod->name, ret, __func__, mod->name, ret, __func__);
__func__);
dump_stack(); dump_stack();
} }
...@@ -3205,10 +3193,8 @@ static int unknown_module_param_cb(char *param, char *val, const char *modname) ...@@ -3205,10 +3193,8 @@ static int unknown_module_param_cb(char *param, char *val, const char *modname)
{ {
/* Check for magic 'dyndbg' arg */ /* Check for magic 'dyndbg' arg */
int ret = ddebug_dyndbg_module_param_cb(param, val, modname); int ret = ddebug_dyndbg_module_param_cb(param, val, modname);
if (ret != 0) { if (ret != 0)
printk(KERN_WARNING "%s: unknown parameter '%s' ignored\n", pr_warn("%s: unknown parameter '%s' ignored\n", modname, param);
modname, param);
}
return 0; return 0;
} }
...@@ -3243,10 +3229,9 @@ static int load_module(struct load_info *info, const char __user *uargs, ...@@ -3243,10 +3229,9 @@ static int load_module(struct load_info *info, const char __user *uargs,
#ifdef CONFIG_MODULE_SIG #ifdef CONFIG_MODULE_SIG
mod->sig_ok = info->sig_ok; mod->sig_ok = info->sig_ok;
if (!mod->sig_ok) { if (!mod->sig_ok) {
printk_once(KERN_NOTICE pr_notice_once("%s: module verification failed: signature "
"%s: module verification failed: signature and/or" "and/or required key missing - tainting "
" required key missing - tainting kernel\n", "kernel\n", mod->name);
mod->name);
add_taint_module(mod, TAINT_FORCED_MODULE, LOCKDEP_STILL_OK); add_taint_module(mod, TAINT_FORCED_MODULE, LOCKDEP_STILL_OK);
} }
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment