diff options
author | Ingo Molnar <mingo@elte.hu> | 2009-04-07 06:05:21 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-04-07 06:05:25 -0400 |
commit | 6c009ecef8cca28c7c09eb16d0802e37915a76e1 (patch) | |
tree | 11c773f780186fdb9fbc9c80a73fb7c8426b1fba /drivers/mtd/mtdoops.c | |
parent | 98c2aaf8be5baf7193be37fb28bce8e7327158bc (diff) | |
parent | d508afb437daee7cf07da085b635c44a4ebf9b38 (diff) |
Merge branch 'linus' into perfcounters/core
Merge reason: need the upstream facility added by:
7f1e2ca: hrtimer: fix rq->lock inversion (again)
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'drivers/mtd/mtdoops.c')
-rw-r--r-- | drivers/mtd/mtdoops.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/drivers/mtd/mtdoops.c b/drivers/mtd/mtdoops.c index 1a6b3beabe8d..1060337c06df 100644 --- a/drivers/mtd/mtdoops.c +++ b/drivers/mtd/mtdoops.c | |||
@@ -44,6 +44,7 @@ static struct mtdoops_context { | |||
44 | int oops_pages; | 44 | int oops_pages; |
45 | int nextpage; | 45 | int nextpage; |
46 | int nextcount; | 46 | int nextcount; |
47 | char *name; | ||
47 | 48 | ||
48 | void *oops_buf; | 49 | void *oops_buf; |
49 | 50 | ||
@@ -273,6 +274,9 @@ static void mtdoops_notify_add(struct mtd_info *mtd) | |||
273 | { | 274 | { |
274 | struct mtdoops_context *cxt = &oops_cxt; | 275 | struct mtdoops_context *cxt = &oops_cxt; |
275 | 276 | ||
277 | if (cxt->name && !strcmp(mtd->name, cxt->name)) | ||
278 | cxt->mtd_index = mtd->index; | ||
279 | |||
276 | if ((mtd->index != cxt->mtd_index) || cxt->mtd_index < 0) | 280 | if ((mtd->index != cxt->mtd_index) || cxt->mtd_index < 0) |
277 | return; | 281 | return; |
278 | 282 | ||
@@ -357,8 +361,10 @@ mtdoops_console_write(struct console *co, const char *s, unsigned int count) | |||
357 | spin_lock_irqsave(&cxt->writecount_lock, flags); | 361 | spin_lock_irqsave(&cxt->writecount_lock, flags); |
358 | 362 | ||
359 | /* Check ready status didn't change whilst waiting for the lock */ | 363 | /* Check ready status didn't change whilst waiting for the lock */ |
360 | if (!cxt->ready) | 364 | if (!cxt->ready) { |
365 | spin_unlock_irqrestore(&cxt->writecount_lock, flags); | ||
361 | return; | 366 | return; |
367 | } | ||
362 | 368 | ||
363 | if (cxt->writecount == 0) { | 369 | if (cxt->writecount == 0) { |
364 | u32 *stamp = cxt->oops_buf; | 370 | u32 *stamp = cxt->oops_buf; |
@@ -383,8 +389,12 @@ static int __init mtdoops_console_setup(struct console *co, char *options) | |||
383 | { | 389 | { |
384 | struct mtdoops_context *cxt = co->data; | 390 | struct mtdoops_context *cxt = co->data; |
385 | 391 | ||
386 | if (cxt->mtd_index != -1) | 392 | if (cxt->mtd_index != -1 || cxt->name) |
387 | return -EBUSY; | 393 | return -EBUSY; |
394 | if (options) { | ||
395 | cxt->name = kstrdup(options, GFP_KERNEL); | ||
396 | return 0; | ||
397 | } | ||
388 | if (co->index == -1) | 398 | if (co->index == -1) |
389 | return -EINVAL; | 399 | return -EINVAL; |
390 | 400 | ||
@@ -412,6 +422,7 @@ static int __init mtdoops_console_init(void) | |||
412 | 422 | ||
413 | cxt->mtd_index = -1; | 423 | cxt->mtd_index = -1; |
414 | cxt->oops_buf = vmalloc(OOPS_PAGE_SIZE); | 424 | cxt->oops_buf = vmalloc(OOPS_PAGE_SIZE); |
425 | spin_lock_init(&cxt->writecount_lock); | ||
415 | 426 | ||
416 | if (!cxt->oops_buf) { | 427 | if (!cxt->oops_buf) { |
417 | printk(KERN_ERR "Failed to allocate mtdoops buffer workspace\n"); | 428 | printk(KERN_ERR "Failed to allocate mtdoops buffer workspace\n"); |
@@ -432,6 +443,7 @@ static void __exit mtdoops_console_exit(void) | |||
432 | 443 | ||
433 | unregister_mtd_user(&mtdoops_notifier); | 444 | unregister_mtd_user(&mtdoops_notifier); |
434 | unregister_console(&mtdoops_console); | 445 | unregister_console(&mtdoops_console); |
446 | kfree(cxt->name); | ||
435 | vfree(cxt->oops_buf); | 447 | vfree(cxt->oops_buf); |
436 | } | 448 | } |
437 | 449 | ||