diff options
author | Andrew Morton <akpm@linux-foundation.org> | 2013-11-12 18:11:28 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-11-12 22:09:34 -0500 |
commit | bddb12b32f90c571b177439a650f1046c3185c2e (patch) | |
tree | baedcc252b57e048c3b978dfecc1d53ddc9d5203 /kernel/module.c | |
parent | 17c568d60af5a810208baf116dc174a2005c6c3e (diff) |
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: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel/module.c')
-rw-r--r-- | kernel/module.c | 103 |
1 files changed, 44 insertions, 59 deletions
diff --git a/kernel/module.c b/kernel/module.c index dc582749fa13..af5ebd21d77b 100644 --- a/kernel/module.c +++ b/kernel/module.c | |||
@@ -378,23 +378,21 @@ static bool check_symbol(const struct symsearch *syms, | |||
378 | if (syms->licence == GPL_ONLY) | 378 | if (syms->licence == GPL_ONLY) |
379 | return false; | 379 | return false; |
380 | if (syms->licence == WILL_BE_GPL_ONLY && fsa->warn) { | 380 | if (syms->licence == WILL_BE_GPL_ONLY && fsa->warn) { |
381 | printk(KERN_WARNING "Symbol %s is being used " | 381 | pr_warn("Symbol %s is being used by a non-GPL module, " |
382 | "by a non-GPL module, which will not " | 382 | "which will not be allowed in the future\n", |
383 | "be allowed in the future\n", fsa->name); | 383 | fsa->name); |
384 | } | 384 | } |
385 | } | 385 | } |
386 | 386 | ||
387 | #ifdef CONFIG_UNUSED_SYMBOLS | 387 | #ifdef CONFIG_UNUSED_SYMBOLS |
388 | if (syms->unused && fsa->warn) { | 388 | if (syms->unused && fsa->warn) { |
389 | printk(KERN_WARNING "Symbol %s is marked as UNUSED, " | 389 | pr_warn("Symbol %s is marked as UNUSED, however this module is " |
390 | "however this module is using it.\n", fsa->name); | 390 | "using it.\n", fsa->name); |
391 | printk(KERN_WARNING | 391 | pr_warn("This symbol will go away in the future.\n"); |
392 | "This symbol will go away in the future.\n"); | 392 | pr_warn("Please evalute if this is the right api to use and if " |
393 | printk(KERN_WARNING | 393 | "it really is, submit a report the linux kernel " |
394 | "Please evalute if this is the right api to use and if " | 394 | "mailinglist together with submitting your code for " |
395 | "it really is, submit a report the linux kernel " | 395 | "inclusion.\n"); |
396 | "mailinglist together with submitting your code for " | ||
397 | "inclusion.\n"); | ||
398 | } | 396 | } |
399 | #endif | 397 | #endif |
400 | 398 | ||
@@ -492,16 +490,15 @@ static int percpu_modalloc(struct module *mod, struct load_info *info) | |||
492 | return 0; | 490 | return 0; |
493 | 491 | ||
494 | if (align > PAGE_SIZE) { | 492 | if (align > PAGE_SIZE) { |
495 | printk(KERN_WARNING "%s: per-cpu alignment %li > %li\n", | 493 | pr_warn("%s: per-cpu alignment %li > %li\n", |
496 | mod->name, align, PAGE_SIZE); | 494 | mod->name, align, PAGE_SIZE); |
497 | align = PAGE_SIZE; | 495 | align = PAGE_SIZE; |
498 | } | 496 | } |
499 | 497 | ||
500 | mod->percpu = __alloc_reserved_percpu(pcpusec->sh_size, align); | 498 | mod->percpu = __alloc_reserved_percpu(pcpusec->sh_size, align); |
501 | if (!mod->percpu) { | 499 | if (!mod->percpu) { |
502 | printk(KERN_WARNING | 500 | pr_warn("%s: Could not allocate %lu bytes percpu data\n", |
503 | "%s: Could not allocate %lu bytes percpu data\n", | 501 | mod->name, (unsigned long)pcpusec->sh_size); |
504 | mod->name, (unsigned long)pcpusec->sh_size); | ||
505 | return -ENOMEM; | 502 | return -ENOMEM; |
506 | } | 503 | } |
507 | mod->percpu_size = pcpusec->sh_size; | 504 | mod->percpu_size = pcpusec->sh_size; |
@@ -679,7 +676,7 @@ static int add_module_usage(struct module *a, struct module *b) | |||
679 | pr_debug("Allocating new usage for %s.\n", a->name); | 676 | pr_debug("Allocating new usage for %s.\n", a->name); |
680 | use = kmalloc(sizeof(*use), GFP_ATOMIC); | 677 | use = kmalloc(sizeof(*use), GFP_ATOMIC); |
681 | if (!use) { | 678 | if (!use) { |
682 | printk(KERN_WARNING "%s: out of memory loading\n", a->name); | 679 | pr_warn("%s: out of memory loading\n", a->name); |
683 | return -ENOMEM; | 680 | return -ENOMEM; |
684 | } | 681 | } |
685 | 682 | ||
@@ -1145,8 +1142,7 @@ static int try_to_force_load(struct module *mod, const char *reason) | |||
1145 | { | 1142 | { |
1146 | #ifdef CONFIG_MODULE_FORCE_LOAD | 1143 | #ifdef CONFIG_MODULE_FORCE_LOAD |
1147 | if (!test_taint(TAINT_FORCED_MODULE)) | 1144 | if (!test_taint(TAINT_FORCED_MODULE)) |
1148 | printk(KERN_WARNING "%s: %s: kernel tainted.\n", | 1145 | pr_warn("%s: %s: kernel tainted.\n", mod->name, reason); |
1149 | mod->name, reason); | ||
1150 | add_taint_module(mod, TAINT_FORCED_MODULE, LOCKDEP_NOW_UNRELIABLE); | 1146 | add_taint_module(mod, TAINT_FORCED_MODULE, LOCKDEP_NOW_UNRELIABLE); |
1151 | return 0; | 1147 | return 0; |
1152 | #else | 1148 | #else |
@@ -1199,8 +1195,7 @@ static int check_version(Elf_Shdr *sechdrs, | |||
1199 | goto bad_version; | 1195 | goto bad_version; |
1200 | } | 1196 | } |
1201 | 1197 | ||
1202 | printk(KERN_WARNING "%s: no symbol version for %s\n", | 1198 | pr_warn("%s: no symbol version for %s\n", mod->name, symname); |
1203 | mod->name, symname); | ||
1204 | return 0; | 1199 | return 0; |
1205 | 1200 | ||
1206 | bad_version: | 1201 | bad_version: |
@@ -1309,8 +1304,8 @@ resolve_symbol_wait(struct module *mod, | |||
1309 | !IS_ERR(ksym = resolve_symbol(mod, info, name, owner)) | 1304 | !IS_ERR(ksym = resolve_symbol(mod, info, name, owner)) |
1310 | || PTR_ERR(ksym) != -EBUSY, | 1305 | || PTR_ERR(ksym) != -EBUSY, |
1311 | 30 * HZ) <= 0) { | 1306 | 30 * HZ) <= 0) { |
1312 | printk(KERN_WARNING "%s: gave up waiting for init of module %s.\n", | 1307 | pr_warn("%s: gave up waiting for init of module %s.\n", |
1313 | mod->name, owner); | 1308 | mod->name, owner); |
1314 | } | 1309 | } |
1315 | return ksym; | 1310 | return ksym; |
1316 | } | 1311 | } |
@@ -1626,15 +1621,14 @@ static int mod_sysfs_init(struct module *mod) | |||
1626 | struct kobject *kobj; | 1621 | struct kobject *kobj; |
1627 | 1622 | ||
1628 | if (!module_sysfs_initialized) { | 1623 | if (!module_sysfs_initialized) { |
1629 | printk(KERN_ERR "%s: module sysfs not initialized\n", | 1624 | pr_err("%s: module sysfs not initialized\n", mod->name); |
1630 | mod->name); | ||
1631 | err = -EINVAL; | 1625 | err = -EINVAL; |
1632 | goto out; | 1626 | goto out; |
1633 | } | 1627 | } |
1634 | 1628 | ||
1635 | kobj = kset_find_obj(module_kset, mod->name); | 1629 | kobj = kset_find_obj(module_kset, mod->name); |
1636 | if (kobj) { | 1630 | if (kobj) { |
1637 | printk(KERN_ERR "%s: module is already loaded\n", mod->name); | 1631 | pr_err("%s: module is already loaded\n", mod->name); |
1638 | kobject_put(kobj); | 1632 | kobject_put(kobj); |
1639 | err = -EINVAL; | 1633 | err = -EINVAL; |
1640 | goto out; | 1634 | goto out; |
@@ -1961,8 +1955,7 @@ static int verify_export_symbols(struct module *mod) | |||
1961 | for (i = 0; i < ARRAY_SIZE(arr); i++) { | 1955 | for (i = 0; i < ARRAY_SIZE(arr); i++) { |
1962 | for (s = arr[i].sym; s < arr[i].sym + arr[i].num; s++) { | 1956 | for (s = arr[i].sym; s < arr[i].sym + arr[i].num; s++) { |
1963 | if (find_symbol(s->name, &owner, NULL, true, false)) { | 1957 | if (find_symbol(s->name, &owner, NULL, true, false)) { |
1964 | printk(KERN_ERR | 1958 | pr_err("%s: exports duplicate symbol %s" |
1965 | "%s: exports duplicate symbol %s" | ||
1966 | " (owned by %s)\n", | 1959 | " (owned by %s)\n", |
1967 | mod->name, s->name, module_name(owner)); | 1960 | mod->name, s->name, module_name(owner)); |
1968 | return -ENOEXEC; | 1961 | return -ENOEXEC; |
@@ -2013,8 +2006,8 @@ static int simplify_symbols(struct module *mod, const struct load_info *info) | |||
2013 | if (!ksym && ELF_ST_BIND(sym[i].st_info) == STB_WEAK) | 2006 | if (!ksym && ELF_ST_BIND(sym[i].st_info) == STB_WEAK) |
2014 | break; | 2007 | break; |
2015 | 2008 | ||
2016 | printk(KERN_WARNING "%s: Unknown symbol %s (err %li)\n", | 2009 | pr_warn("%s: Unknown symbol %s (err %li)\n", |
2017 | mod->name, name, PTR_ERR(ksym)); | 2010 | mod->name, name, PTR_ERR(ksym)); |
2018 | ret = PTR_ERR(ksym) ?: -ENOENT; | 2011 | ret = PTR_ERR(ksym) ?: -ENOENT; |
2019 | break; | 2012 | break; |
2020 | 2013 | ||
@@ -2168,8 +2161,8 @@ static void set_license(struct module *mod, const char *license) | |||
2168 | 2161 | ||
2169 | if (!license_is_gpl_compatible(license)) { | 2162 | if (!license_is_gpl_compatible(license)) { |
2170 | if (!test_taint(TAINT_PROPRIETARY_MODULE)) | 2163 | if (!test_taint(TAINT_PROPRIETARY_MODULE)) |
2171 | printk(KERN_WARNING "%s: module license '%s' taints " | 2164 | pr_warn("%s: module license '%s' taints kernel.\n", |
2172 | "kernel.\n", mod->name, license); | 2165 | mod->name, license); |
2173 | add_taint_module(mod, TAINT_PROPRIETARY_MODULE, | 2166 | add_taint_module(mod, TAINT_PROPRIETARY_MODULE, |
2174 | LOCKDEP_NOW_UNRELIABLE); | 2167 | LOCKDEP_NOW_UNRELIABLE); |
2175 | } | 2168 | } |
@@ -2405,8 +2398,8 @@ static void dynamic_debug_setup(struct _ddebug *debug, unsigned int num) | |||
2405 | return; | 2398 | return; |
2406 | #ifdef CONFIG_DYNAMIC_DEBUG | 2399 | #ifdef CONFIG_DYNAMIC_DEBUG |
2407 | if (ddebug_add_module(debug, num, debug->modname)) | 2400 | if (ddebug_add_module(debug, num, debug->modname)) |
2408 | printk(KERN_ERR "dynamic debug error adding module: %s\n", | 2401 | pr_err("dynamic debug error adding module: %s\n", |
2409 | debug->modname); | 2402 | debug->modname); |
2410 | #endif | 2403 | #endif |
2411 | } | 2404 | } |
2412 | 2405 | ||
@@ -2619,8 +2612,7 @@ static int rewrite_section_headers(struct load_info *info, int flags) | |||
2619 | Elf_Shdr *shdr = &info->sechdrs[i]; | 2612 | Elf_Shdr *shdr = &info->sechdrs[i]; |
2620 | if (shdr->sh_type != SHT_NOBITS | 2613 | if (shdr->sh_type != SHT_NOBITS |
2621 | && info->len < shdr->sh_offset + shdr->sh_size) { | 2614 | && info->len < shdr->sh_offset + shdr->sh_size) { |
2622 | printk(KERN_ERR "Module len %lu truncated\n", | 2615 | pr_err("Module len %lu truncated\n", info->len); |
2623 | info->len); | ||
2624 | return -ENOEXEC; | 2616 | return -ENOEXEC; |
2625 | } | 2617 | } |
2626 | 2618 | ||
@@ -2682,15 +2674,14 @@ static struct module *setup_load_info(struct load_info *info, int flags) | |||
2682 | 2674 | ||
2683 | info->index.mod = find_sec(info, ".gnu.linkonce.this_module"); | 2675 | info->index.mod = find_sec(info, ".gnu.linkonce.this_module"); |
2684 | if (!info->index.mod) { | 2676 | if (!info->index.mod) { |
2685 | printk(KERN_WARNING "No module found in object\n"); | 2677 | pr_warn("No module found in object\n"); |
2686 | return ERR_PTR(-ENOEXEC); | 2678 | return ERR_PTR(-ENOEXEC); |
2687 | } | 2679 | } |
2688 | /* This is temporary: point mod into copy of data. */ | 2680 | /* This is temporary: point mod into copy of data. */ |
2689 | mod = (void *)info->sechdrs[info->index.mod].sh_addr; | 2681 | mod = (void *)info->sechdrs[info->index.mod].sh_addr; |
2690 | 2682 | ||
2691 | if (info->index.sym == 0) { | 2683 | if (info->index.sym == 0) { |
2692 | printk(KERN_WARNING "%s: module has no symbols (stripped?)\n", | 2684 | pr_warn("%s: module has no symbols (stripped?)\n", mod->name); |
2693 | mod->name); | ||
2694 | return ERR_PTR(-ENOEXEC); | 2685 | return ERR_PTR(-ENOEXEC); |
2695 | } | 2686 | } |
2696 | 2687 | ||
@@ -2717,7 +2708,7 @@ static int check_modinfo(struct module *mod, struct load_info *info, int flags) | |||
2717 | if (err) | 2708 | if (err) |
2718 | return err; | 2709 | return err; |
2719 | } else if (!same_magic(modmagic, vermagic, info->index.vers)) { | 2710 | } else if (!same_magic(modmagic, vermagic, info->index.vers)) { |
2720 | printk(KERN_ERR "%s: version magic '%s' should be '%s'\n", | 2711 | pr_err("%s: version magic '%s' should be '%s'\n", |
2721 | mod->name, modmagic, vermagic); | 2712 | mod->name, modmagic, vermagic); |
2722 | return -ENOEXEC; | 2713 | return -ENOEXEC; |
2723 | } | 2714 | } |
@@ -2727,9 +2718,8 @@ static int check_modinfo(struct module *mod, struct load_info *info, int flags) | |||
2727 | 2718 | ||
2728 | if (get_modinfo(info, "staging")) { | 2719 | if (get_modinfo(info, "staging")) { |
2729 | add_taint_module(mod, TAINT_CRAP, LOCKDEP_STILL_OK); | 2720 | add_taint_module(mod, TAINT_CRAP, LOCKDEP_STILL_OK); |
2730 | printk(KERN_WARNING "%s: module is from the staging directory," | 2721 | pr_warn("%s: module is from the staging directory, the quality " |
2731 | " the quality is unknown, you have been warned.\n", | 2722 | "is unknown, you have been warned.\n", mod->name); |
2732 | mod->name); | ||
2733 | } | 2723 | } |
2734 | 2724 | ||
2735 | /* Set up license info based on the info section */ | 2725 | /* 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 | sizeof(*mod->extable), &mod->num_exentries); | 2791 | sizeof(*mod->extable), &mod->num_exentries); |
2802 | 2792 | ||
2803 | if (section_addr(info, "__obsparm")) | 2793 | if (section_addr(info, "__obsparm")) |
2804 | printk(KERN_WARNING "%s: Ignoring obsolete parameters\n", | 2794 | pr_warn("%s: Ignoring obsolete parameters\n", mod->name); |
2805 | mod->name); | ||
2806 | 2795 | ||
2807 | info->debug = section_objs(info, "__verbose", | 2796 | info->debug = section_objs(info, "__verbose", |
2808 | sizeof(*info->debug), &info->num_debug); | 2797 | sizeof(*info->debug), &info->num_debug); |
@@ -3078,11 +3067,10 @@ static int do_init_module(struct module *mod) | |||
3078 | return ret; | 3067 | return ret; |
3079 | } | 3068 | } |
3080 | if (ret > 0) { | 3069 | if (ret > 0) { |
3081 | printk(KERN_WARNING | 3070 | pr_warn("%s: '%s'->init suspiciously returned %d, it should " |
3082 | "%s: '%s'->init suspiciously returned %d, it should follow 0/-E convention\n" | 3071 | "follow 0/-E convention\n" |
3083 | "%s: loading module anyway...\n", | 3072 | "%s: loading module anyway...\n", |
3084 | __func__, mod->name, ret, | 3073 | __func__, mod->name, ret, __func__); |
3085 | __func__); | ||
3086 | dump_stack(); | 3074 | dump_stack(); |
3087 | } | 3075 | } |
3088 | 3076 | ||
@@ -3205,10 +3193,8 @@ static int unknown_module_param_cb(char *param, char *val, const char *modname) | |||
3205 | { | 3193 | { |
3206 | /* Check for magic 'dyndbg' arg */ | 3194 | /* Check for magic 'dyndbg' arg */ |
3207 | int ret = ddebug_dyndbg_module_param_cb(param, val, modname); | 3195 | int ret = ddebug_dyndbg_module_param_cb(param, val, modname); |
3208 | if (ret != 0) { | 3196 | if (ret != 0) |
3209 | printk(KERN_WARNING "%s: unknown parameter '%s' ignored\n", | 3197 | pr_warn("%s: unknown parameter '%s' ignored\n", modname, param); |
3210 | modname, param); | ||
3211 | } | ||
3212 | return 0; | 3198 | return 0; |
3213 | } | 3199 | } |
3214 | 3200 | ||
@@ -3243,10 +3229,9 @@ static int load_module(struct load_info *info, const char __user *uargs, | |||
3243 | #ifdef CONFIG_MODULE_SIG | 3229 | #ifdef CONFIG_MODULE_SIG |
3244 | mod->sig_ok = info->sig_ok; | 3230 | mod->sig_ok = info->sig_ok; |
3245 | if (!mod->sig_ok) { | 3231 | if (!mod->sig_ok) { |
3246 | printk_once(KERN_NOTICE | 3232 | pr_notice_once("%s: module verification failed: signature " |
3247 | "%s: module verification failed: signature and/or" | 3233 | "and/or required key missing - tainting " |
3248 | " required key missing - tainting kernel\n", | 3234 | "kernel\n", mod->name); |
3249 | mod->name); | ||
3250 | add_taint_module(mod, TAINT_FORCED_MODULE, LOCKDEP_STILL_OK); | 3235 | add_taint_module(mod, TAINT_FORCED_MODULE, LOCKDEP_STILL_OK); |
3251 | } | 3236 | } |
3252 | #endif | 3237 | #endif |