Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 218621
b: refs/heads/master
c: c3b92ce
h: refs/heads/master
i:
  218619: 89333fe
v: v3
  • Loading branch information
Kyungmin Park authored and Linus Torvalds committed Oct 28, 2010
1 parent 521df5d commit 210fc5f
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 5de1cb2d0f1c1e5475d2bedf65b76828f8cdde22
refs/heads/master: c3b92ce9e75f6353104fc7f8e32fb9fdb2550ad0
30 changes: 28 additions & 2 deletions trunk/drivers/char/ramoops.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
#include <linux/time.h>
#include <linux/io.h>
#include <linux/ioport.h>
#include <linux/platform_device.h>
#include <linux/ramoops.h>

#define RAMOOPS_KERNMSG_HDR "===="
#define RAMOOPS_HEADER_SIZE (5 + sizeof(struct timeval))
Expand Down Expand Up @@ -91,11 +93,17 @@ static void ramoops_do_dump(struct kmsg_dumper *dumper,
cxt->count = (cxt->count + 1) % cxt->max_count;
}

static int __init ramoops_init(void)
static int __init ramoops_probe(struct platform_device *pdev)
{
struct ramoops_platform_data *pdata = pdev->dev.platform_data;
struct ramoops_context *cxt = &oops_cxt;
int err = -EINVAL;

if (pdata) {
mem_size = pdata->mem_size;
mem_address = pdata->mem_address;
}

if (!mem_size) {
printk(KERN_ERR "ramoops: invalid size specification");
goto fail3;
Expand Down Expand Up @@ -142,7 +150,7 @@ static int __init ramoops_init(void)
return err;
}

static void __exit ramoops_exit(void)
static int __exit ramoops_remove(struct platform_device *pdev)
{
struct ramoops_context *cxt = &oops_cxt;

Expand All @@ -151,8 +159,26 @@ static void __exit ramoops_exit(void)

iounmap(cxt->virt_addr);
release_mem_region(cxt->phys_addr, cxt->size);
return 0;
}

static struct platform_driver ramoops_driver = {
.remove = __exit_p(ramoops_remove),
.driver = {
.name = "ramoops",
.owner = THIS_MODULE,
},
};

static int __init ramoops_init(void)
{
return platform_driver_probe(&ramoops_driver, ramoops_probe);
}

static void __exit ramoops_exit(void)
{
platform_driver_unregister(&ramoops_driver);
}

module_init(ramoops_init);
module_exit(ramoops_exit);
Expand Down
15 changes: 15 additions & 0 deletions trunk/include/linux/ramoops.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#ifndef __RAMOOPS_H
#define __RAMOOPS_H

/*
* Ramoops platform data
* @mem_size memory size for ramoops
* @mem_address physical memory address to contain ramoops
*/

struct ramoops_platform_data {
unsigned long mem_size;
unsigned long mem_address;
};

#endif

0 comments on commit 210fc5f

Please sign in to comment.