I left 1 printk which uses __FILE__, __LINE__ explicitly, which should not be subject to generic preferences expressed via pr_fmt(). + tweaks suggested by Joe Perches: - add doing to irq-enabled warning, like others. It wont happen often.. - change sysfs failure crit, not just err, make it 1 line in logs. - coalese 2 format fragments into 1 >80 char line
Showing the changes to kernel (1 of 1 file). Show all
Unified · Split
| @@ -201,25 +201,22 @@ int parse_args(const char *doing, · 200 unmodified lines | ||
| 201 | 201 | irq_was_disabled = irqs_disabled(); |
| 202 | 202 | ret = parse_one(param, val, doing, params, num, |
| 203 | 203 | min_level, max_level, unknown); |
| 204 | − if (irq_was_disabled && !irqs_disabled()) { | |
| 205 | − printk(KERN_WARNING "parse_args(): option '%s' enabled " | |
| 206 | − "irq's!\n", param); | |
| 207 | − } | |
| 204 | + if (irq_was_disabled && !irqs_disabled()) | |
| 205 | + pr_warn("%s: option '%s' enabled irq's!\n", | |
| 206 | + doing, param); | |
| 207 | + | |
| 208 | 208 | switch (ret) { |
| 209 | 209 | case -ENOENT: |
| 210 | − printk(KERN_ERR "%s: Unknown parameter `%s'\n", | |
| 211 | − doing, param); | |
| 210 | + pr_err("%s: Unknown parameter `%s'\n", doing, param); | |
| 212 | 211 | return ret; |
| 213 | 212 | case -ENOSPC: |
| 214 | − printk(KERN_ERR | |
| 215 | − "%s: `%s' too large for parameter `%s'\n", | |
| 213 | + pr_err("%s: `%s' too large for parameter `%s'\n", | |
| 216 | 214 | doing, val ?: "", param); |
| 217 | 215 | return ret; |
| 218 | 216 | case 0: |
| 219 | 217 | break; |
| 220 | 218 | default: |
| 221 | − printk(KERN_ERR | |
| 222 | − "%s: `%s' invalid for parameter `%s'\n", | |
| 219 | + pr_err("%s: `%s' invalid for parameter `%s'\n", | |
| 223 | 220 | doing, val ?: "", param); |
| 224 | 221 | return ret; |
| 225 | 222 | } |
| @@ -266,8 +263,7 @@ STANDARD_PARAM_DEF(ulong, unsigned long, "%lu", unsigned long, strict_strtoul); · 40 unmodified lines | ||
| 266 | 263 | int param_set_charp(const char *val, const struct kernel_param *kp) |
| 267 | 264 | { |
| 268 | 265 | if (strlen(val) > 1024) { |
| 269 | − printk(KERN_ERR "%s: string parameter too long\n", | |
| 270 | − kp->name); | |
| 266 | + pr_err("%s: string parameter too long\n", kp->name); | |
| 271 | 267 | return -ENOSPC; |
| 272 | 268 | } |
| 273 | 269 | |
| @@ -403,8 +399,7 @@ static int param_array(const char *name, · 129 unmodified lines | ||
| 403 | 399 | int len; |
| 404 | 400 | |
| 405 | 401 | if (*num == max) { |
| 406 | − printk(KERN_ERR "%s: can only take %i arguments\n", | |
| 407 | − name, max); | |
| 402 | + pr_err("%s: can only take %i arguments\n", name, max); | |
| 408 | 403 | return -EINVAL; |
| 409 | 404 | } |
| 410 | 405 | len = strcspn(val, ","); |
| @@ -423,8 +418,7 @@ static int param_array(const char *name, · 12 unmodified lines | ||
| 423 | 418 | } while (save == ','); |
| 424 | 419 | |
| 425 | 420 | if (*num < min) { |
| 426 | − printk(KERN_ERR "%s: needs at least %i arguments\n", | |
| 427 | − name, min); | |
| 421 | + pr_err("%s: needs at least %i arguments\n", name, min); | |
| 428 | 422 | return -EINVAL; |
| 429 | 423 | } |
| 430 | 424 | return 0; |
| @@ -483,7 +477,7 @@ int param_set_copystring(const char *val, const struct kernel_param *kp) · 52 unmodified lines | ||
| 483 | 477 | const struct kparam_string *kps = kp->str; |
| 484 | 478 | |
| 485 | 479 | if (strlen(val)+1 > kps->maxlen) { |
| 486 | − printk(KERN_ERR "%s: string doesn't fit in %u chars.\n", | |
| 480 | + pr_err("%s: string doesn't fit in %u chars.\n", | |
| 487 | 481 | kp->name, kps->maxlen-1); |
| 488 | 482 | return -ENOSPC; |
| 489 | 483 | } |
| @@ -753,11 +747,8 @@ static struct module_kobject * __init locate_module_kobject(const char *name) · 263 unmodified lines | ||
| 753 | 747 | #endif |
| 754 | 748 | if (err) { |
| 755 | 749 | kobject_put(&mk->kobj); |
| 756 | − printk(KERN_ERR | |
| 757 | − "Module '%s' failed add to sysfs, error number %d\n", | |
| 750 | + pr_crit("Adding module '%s' to sysfs failed (%d), the system may be unstable.\n", | |
| 758 | 751 | name, err); |
| 759 | − printk(KERN_ERR | |
| 760 | − "The system will be unstable now.\n"); | |
| 761 | 752 | return NULL; |
| 762 | 753 | } |
| 763 | 754 | |