aboutsummaryrefslogtreecommitdiffstats
path: root/fs/pstore/ram.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/pstore/ram.c')
-rw-r--r--fs/pstore/ram.c63
1 files changed, 32 insertions, 31 deletions
diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c
index c7acf94ff475..0b36e91978e6 100644
--- a/fs/pstore/ram.c
+++ b/fs/pstore/ram.c
@@ -330,7 +330,7 @@ static int ramoops_init_prz(struct device *dev, struct ramoops_context *cxt,
330 return 0; 330 return 0;
331} 331}
332 332
333static int __init ramoops_probe(struct platform_device *pdev) 333static int __devinit ramoops_probe(struct platform_device *pdev)
334{ 334{
335 struct device *dev = &pdev->dev; 335 struct device *dev = &pdev->dev;
336 struct ramoops_platform_data *pdata = pdev->dev.platform_data; 336 struct ramoops_platform_data *pdata = pdev->dev.platform_data;
@@ -452,6 +452,7 @@ static int __exit ramoops_remove(struct platform_device *pdev)
452} 452}
453 453
454static struct platform_driver ramoops_driver = { 454static struct platform_driver ramoops_driver = {
455 .probe = ramoops_probe,
455 .remove = __exit_p(ramoops_remove), 456 .remove = __exit_p(ramoops_remove),
456 .driver = { 457 .driver = {
457 .name = "ramoops", 458 .name = "ramoops",
@@ -459,46 +460,46 @@ static struct platform_driver ramoops_driver = {
459 }, 460 },
460}; 461};
461 462
462static int __init ramoops_init(void) 463static void ramoops_register_dummy(void)
463{ 464{
464 int ret; 465 if (!mem_size)
465 ret = platform_driver_probe(&ramoops_driver, ramoops_probe); 466 return;
466 if (ret == -ENODEV) { 467
467 /* 468 pr_info("using module parameters\n");
468 * If we didn't find a platform device, we use module parameters 469
469 * building platform data on the fly. 470 dummy_data = kzalloc(sizeof(*dummy_data), GFP_KERNEL);
470 */ 471 if (!dummy_data) {
471 pr_info("platform device not found, using module parameters\n"); 472 pr_info("could not allocate pdata\n");
472 dummy_data = kzalloc(sizeof(struct ramoops_platform_data), 473 return;
473 GFP_KERNEL);
474 if (!dummy_data)
475 return -ENOMEM;
476 dummy_data->mem_size = mem_size;
477 dummy_data->mem_address = mem_address;
478 dummy_data->record_size = record_size;
479 dummy_data->console_size = ramoops_console_size;
480 dummy_data->dump_oops = dump_oops;
481 dummy_data->ecc = ramoops_ecc;
482 dummy = platform_create_bundle(&ramoops_driver, ramoops_probe,
483 NULL, 0, dummy_data,
484 sizeof(struct ramoops_platform_data));
485
486 if (IS_ERR(dummy))
487 ret = PTR_ERR(dummy);
488 else
489 ret = 0;
490 } 474 }
491 475
492 return ret; 476 dummy_data->mem_size = mem_size;
477 dummy_data->mem_address = mem_address;
478 dummy_data->record_size = record_size;
479 dummy_data->console_size = ramoops_console_size;
480 dummy_data->dump_oops = dump_oops;
481 dummy_data->ecc = ramoops_ecc;
482
483 dummy = platform_device_register_data(NULL, "ramoops", -1,
484 dummy_data, sizeof(struct ramoops_platform_data));
485 if (IS_ERR(dummy)) {
486 pr_info("could not create platform device: %ld\n",
487 PTR_ERR(dummy));
488 }
489}
490
491static int __init ramoops_init(void)
492{
493 ramoops_register_dummy();
494 return platform_driver_register(&ramoops_driver);
493} 495}
496postcore_initcall(ramoops_init);
494 497
495static void __exit ramoops_exit(void) 498static void __exit ramoops_exit(void)
496{ 499{
497 platform_driver_unregister(&ramoops_driver); 500 platform_driver_unregister(&ramoops_driver);
498 kfree(dummy_data); 501 kfree(dummy_data);
499} 502}
500
501module_init(ramoops_init);
502module_exit(ramoops_exit); 503module_exit(ramoops_exit);
503 504
504MODULE_LICENSE("GPL"); 505MODULE_LICENSE("GPL");