aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/mtdoops.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mtd/mtdoops.c')
-rw-r--r--drivers/mtd/mtdoops.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/drivers/mtd/mtdoops.c b/drivers/mtd/mtdoops.c
index 1a6b3beabe8d..fdf504fb319a 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
@@ -383,8 +387,12 @@ static int __init mtdoops_console_setup(struct console *co, char *options)
383{ 387{
384 struct mtdoops_context *cxt = co->data; 388 struct mtdoops_context *cxt = co->data;
385 389
386 if (cxt->mtd_index != -1) 390 if (cxt->mtd_index != -1 || cxt->name)
387 return -EBUSY; 391 return -EBUSY;
392 if (options) {
393 cxt->name = kstrdup(options, GFP_KERNEL);
394 return 0;
395 }
388 if (co->index == -1) 396 if (co->index == -1)
389 return -EINVAL; 397 return -EINVAL;
390 398
@@ -432,6 +440,7 @@ static void __exit mtdoops_console_exit(void)
432 440
433 unregister_mtd_user(&mtdoops_notifier); 441 unregister_mtd_user(&mtdoops_notifier);
434 unregister_console(&mtdoops_console); 442 unregister_console(&mtdoops_console);
443 kfree(cxt->name);
435 vfree(cxt->oops_buf); 444 vfree(cxt->oops_buf);
436} 445}
437 446