diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-10-25 06:13:59 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-10-25 06:13:59 -0400 |
| commit | 2d03423b2319cc854adeb28a03f65de5b5e0ab63 (patch) | |
| tree | 20d9ddb661f3247f5dfaa6da8212123ed14a24c4 /lib | |
| parent | 59e52534172d845ebffb0d7e85fc56fb7b857051 (diff) | |
| parent | 2bbcb8788311a40714b585fc11b51da6ffa2ab92 (diff) | |
Merge branch 'driver-core-next' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core
* 'driver-core-next' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: (38 commits)
mm: memory hotplug: Check if pages are correctly reserved on a per-section basis
Revert "memory hotplug: Correct page reservation checking"
Update email address for stable patch submission
dynamic_debug: fix undefined reference to `__netdev_printk'
dynamic_debug: use a single printk() to emit messages
dynamic_debug: remove num_enabled accounting
dynamic_debug: consolidate repetitive struct _ddebug descriptor definitions
uio: Support physical addresses >32 bits on 32-bit systems
sysfs: add unsigned long cast to prevent compile warning
drivers: base: print rejected matches with DEBUG_DRIVER
memory hotplug: Correct page reservation checking
memory hotplug: Refuse to add unaligned memory regions
remove the messy code file Documentation/zh_CN/SubmitChecklist
ARM: mxc: convert device creation to use platform_device_register_full
new helper to create platform devices with dma mask
docs/driver-model: Update device class docs
docs/driver-model: Document device.groups
kobj_uevent: Ignore if some listeners cannot handle message
dynamic_debug: make netif_dbg() call __netdev_printk()
dynamic_debug: make netdev_dbg() call __netdev_printk()
...
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/dynamic_debug.c | 173 | ||||
| -rw-r--r-- | lib/kobject_uevent.c | 2 |
2 files changed, 120 insertions, 55 deletions
diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index 79fc20b65e74..dcdade39e47f 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c | |||
| @@ -10,6 +10,8 @@ | |||
| 10 | * Copyright (C) 2011 Bart Van Assche. All Rights Reserved. | 10 | * Copyright (C) 2011 Bart Van Assche. All Rights Reserved. |
| 11 | */ | 11 | */ |
| 12 | 12 | ||
| 13 | #define pr_fmt(fmt) KBUILD_MODNAME ":%s: " fmt, __func__ | ||
| 14 | |||
| 13 | #include <linux/kernel.h> | 15 | #include <linux/kernel.h> |
| 14 | #include <linux/module.h> | 16 | #include <linux/module.h> |
| 15 | #include <linux/moduleparam.h> | 17 | #include <linux/moduleparam.h> |
| @@ -29,6 +31,8 @@ | |||
| 29 | #include <linux/jump_label.h> | 31 | #include <linux/jump_label.h> |
| 30 | #include <linux/hardirq.h> | 32 | #include <linux/hardirq.h> |
| 31 | #include <linux/sched.h> | 33 | #include <linux/sched.h> |
| 34 | #include <linux/device.h> | ||
| 35 | #include <linux/netdevice.h> | ||
| 32 | 36 | ||
| 33 | extern struct _ddebug __start___verbose[]; | 37 | extern struct _ddebug __start___verbose[]; |
| 34 | extern struct _ddebug __stop___verbose[]; | 38 | extern struct _ddebug __stop___verbose[]; |
| @@ -37,7 +41,6 @@ struct ddebug_table { | |||
| 37 | struct list_head link; | 41 | struct list_head link; |
| 38 | char *mod_name; | 42 | char *mod_name; |
| 39 | unsigned int num_ddebugs; | 43 | unsigned int num_ddebugs; |
| 40 | unsigned int num_enabled; | ||
| 41 | struct _ddebug *ddebugs; | 44 | struct _ddebug *ddebugs; |
| 42 | }; | 45 | }; |
| 43 | 46 | ||
| @@ -147,19 +150,13 @@ static void ddebug_change(const struct ddebug_query *query, | |||
| 147 | newflags = (dp->flags & mask) | flags; | 150 | newflags = (dp->flags & mask) | flags; |
| 148 | if (newflags == dp->flags) | 151 | if (newflags == dp->flags) |
| 149 | continue; | 152 | continue; |
| 150 | |||
| 151 | if (!newflags) | ||
| 152 | dt->num_enabled--; | ||
| 153 | else if (!dp->flags) | ||
| 154 | dt->num_enabled++; | ||
| 155 | dp->flags = newflags; | 153 | dp->flags = newflags; |
| 156 | if (newflags) | 154 | if (newflags) |
| 157 | dp->enabled = 1; | 155 | dp->enabled = 1; |
| 158 | else | 156 | else |
| 159 | dp->enabled = 0; | 157 | dp->enabled = 0; |
| 160 | if (verbose) | 158 | if (verbose) |
| 161 | printk(KERN_INFO | 159 | pr_info("changed %s:%d [%s]%s %s\n", |
| 162 | "ddebug: changed %s:%d [%s]%s %s\n", | ||
| 163 | dp->filename, dp->lineno, | 160 | dp->filename, dp->lineno, |
| 164 | dt->mod_name, dp->function, | 161 | dt->mod_name, dp->function, |
| 165 | ddebug_describe_flags(dp, flagbuf, | 162 | ddebug_describe_flags(dp, flagbuf, |
| @@ -169,7 +166,7 @@ static void ddebug_change(const struct ddebug_query *query, | |||
| 169 | mutex_unlock(&ddebug_lock); | 166 | mutex_unlock(&ddebug_lock); |
| 170 | 167 | ||
| 171 | if (!nfound && verbose) | 168 | if (!nfound && verbose) |
| 172 | printk(KERN_INFO "ddebug: no matches for query\n"); | 169 | pr_info("no matches for query\n"); |
| 173 | } | 170 | } |
| 174 | 171 | ||
| 175 | /* | 172 | /* |
| @@ -214,10 +211,10 @@ static int ddebug_tokenize(char *buf, char *words[], int maxwords) | |||
| 214 | 211 | ||
| 215 | if (verbose) { | 212 | if (verbose) { |
| 216 | int i; | 213 | int i; |
| 217 | printk(KERN_INFO "%s: split into words:", __func__); | 214 | pr_info("split into words:"); |
| 218 | for (i = 0 ; i < nwords ; i++) | 215 | for (i = 0 ; i < nwords ; i++) |
| 219 | printk(" \"%s\"", words[i]); | 216 | pr_cont(" \"%s\"", words[i]); |
| 220 | printk("\n"); | 217 | pr_cont("\n"); |
| 221 | } | 218 | } |
| 222 | 219 | ||
| 223 | return nwords; | 220 | return nwords; |
| @@ -329,16 +326,15 @@ static int ddebug_parse_query(char *words[], int nwords, | |||
| 329 | } | 326 | } |
| 330 | } else { | 327 | } else { |
| 331 | if (verbose) | 328 | if (verbose) |
| 332 | printk(KERN_ERR "%s: unknown keyword \"%s\"\n", | 329 | pr_err("unknown keyword \"%s\"\n", words[i]); |
| 333 | __func__, words[i]); | ||
| 334 | return -EINVAL; | 330 | return -EINVAL; |
| 335 | } | 331 | } |
| 336 | } | 332 | } |
| 337 | 333 | ||
| 338 | if (verbose) | 334 | if (verbose) |
| 339 | printk(KERN_INFO "%s: q->function=\"%s\" q->filename=\"%s\" " | 335 | pr_info("q->function=\"%s\" q->filename=\"%s\" " |
| 340 | "q->module=\"%s\" q->format=\"%s\" q->lineno=%u-%u\n", | 336 | "q->module=\"%s\" q->format=\"%s\" q->lineno=%u-%u\n", |
| 341 | __func__, query->function, query->filename, | 337 | query->function, query->filename, |
| 342 | query->module, query->format, query->first_lineno, | 338 | query->module, query->format, query->first_lineno, |
| 343 | query->last_lineno); | 339 | query->last_lineno); |
| 344 | 340 | ||
| @@ -367,7 +363,7 @@ static int ddebug_parse_flags(const char *str, unsigned int *flagsp, | |||
| 367 | return -EINVAL; | 363 | return -EINVAL; |
| 368 | } | 364 | } |
| 369 | if (verbose) | 365 | if (verbose) |
| 370 | printk(KERN_INFO "%s: op='%c'\n", __func__, op); | 366 | pr_info("op='%c'\n", op); |
| 371 | 367 | ||
| 372 | for ( ; *str ; ++str) { | 368 | for ( ; *str ; ++str) { |
| 373 | for (i = ARRAY_SIZE(opt_array) - 1; i >= 0; i--) { | 369 | for (i = ARRAY_SIZE(opt_array) - 1; i >= 0; i--) { |
| @@ -382,7 +378,7 @@ static int ddebug_parse_flags(const char *str, unsigned int *flagsp, | |||
| 382 | if (flags == 0) | 378 | if (flags == 0) |
| 383 | return -EINVAL; | 379 | return -EINVAL; |
| 384 | if (verbose) | 380 | if (verbose) |
| 385 | printk(KERN_INFO "%s: flags=0x%x\n", __func__, flags); | 381 | pr_info("flags=0x%x\n", flags); |
| 386 | 382 | ||
| 387 | /* calculate final *flagsp, *maskp according to mask and op */ | 383 | /* calculate final *flagsp, *maskp according to mask and op */ |
| 388 | switch (op) { | 384 | switch (op) { |
| @@ -400,8 +396,7 @@ static int ddebug_parse_flags(const char *str, unsigned int *flagsp, | |||
| 400 | break; | 396 | break; |
| 401 | } | 397 | } |
| 402 | if (verbose) | 398 | if (verbose) |
| 403 | printk(KERN_INFO "%s: *flagsp=0x%x *maskp=0x%x\n", | 399 | pr_info("*flagsp=0x%x *maskp=0x%x\n", *flagsp, *maskp); |
| 404 | __func__, *flagsp, *maskp); | ||
| 405 | return 0; | 400 | return 0; |
| 406 | } | 401 | } |
| 407 | 402 | ||
| @@ -426,40 +421,117 @@ static int ddebug_exec_query(char *query_string) | |||
| 426 | return 0; | 421 | return 0; |
| 427 | } | 422 | } |
| 428 | 423 | ||
| 424 | #define PREFIX_SIZE 64 | ||
| 425 | |||
| 426 | static int remaining(int wrote) | ||
| 427 | { | ||
| 428 | if (PREFIX_SIZE - wrote > 0) | ||
| 429 | return PREFIX_SIZE - wrote; | ||
| 430 | return 0; | ||
| 431 | } | ||
| 432 | |||
| 433 | static char *dynamic_emit_prefix(const struct _ddebug *desc, char *buf) | ||
| 434 | { | ||
| 435 | int pos_after_tid; | ||
| 436 | int pos = 0; | ||
| 437 | |||
| 438 | pos += snprintf(buf + pos, remaining(pos), "%s", KERN_DEBUG); | ||
| 439 | if (desc->flags & _DPRINTK_FLAGS_INCL_TID) { | ||
| 440 | if (in_interrupt()) | ||
| 441 | pos += snprintf(buf + pos, remaining(pos), "%s ", | ||
| 442 | "<intr>"); | ||
| 443 | else | ||
| 444 | pos += snprintf(buf + pos, remaining(pos), "[%d] ", | ||
| 445 | task_pid_vnr(current)); | ||
| 446 | } | ||
| 447 | pos_after_tid = pos; | ||
| 448 | if (desc->flags & _DPRINTK_FLAGS_INCL_MODNAME) | ||
| 449 | pos += snprintf(buf + pos, remaining(pos), "%s:", | ||
| 450 | desc->modname); | ||
| 451 | if (desc->flags & _DPRINTK_FLAGS_INCL_FUNCNAME) | ||
| 452 | pos += snprintf(buf + pos, remaining(pos), "%s:", | ||
| 453 | desc->function); | ||
| 454 | if (desc->flags & _DPRINTK_FLAGS_INCL_LINENO) | ||
| 455 | pos += snprintf(buf + pos, remaining(pos), "%d:", desc->lineno); | ||
| 456 | if (pos - pos_after_tid) | ||
| 457 | pos += snprintf(buf + pos, remaining(pos), " "); | ||
| 458 | if (pos >= PREFIX_SIZE) | ||
