diff options
author | Kyungmin Park <kyungmin.park@samsung.com> | 2010-10-27 18:34:52 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-10-27 21:03:18 -0400 |
commit | c3b92ce9e75f6353104fc7f8e32fb9fdb2550ad0 (patch) | |
tree | 0b3086e8274eaff2741bdbb4199896597a0d9b57 /drivers/char/ramoops.c | |
parent | 5de1cb2d0f1c1e5475d2bedf65b76828f8cdde22 (diff) |
ramoops: use the platform data structure instead of module params
As each board and system has different memory for ramoops. It's better to
define the platform data instead of module params.
[akpm@linux-foundation.org: fix ramoops_remove() return type]
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Cc: Marco Stornelli <marco.stornelli@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/char/ramoops.c')
-rw-r--r-- | drivers/char/ramoops.c | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/drivers/char/ramoops.c b/drivers/char/ramoops.c index 74f00b5ffa36..73dcb0ee41fd 100644 --- a/drivers/char/ramoops.c +++ b/drivers/char/ramoops.c | |||
@@ -25,6 +25,8 @@ | |||
25 | #include <linux/time.h> | 25 | #include <linux/time.h> |
26 | #include <linux/io.h> | 26 | #include <linux/io.h> |
27 | #include <linux/ioport.h> | 27 | #include <linux/ioport.h> |
28 | #include <linux/platform_device.h> | ||
29 | #include <linux/ramoops.h> | ||
28 | 30 | ||
29 | #define RAMOOPS_KERNMSG_HDR "====" | 31 | #define RAMOOPS_KERNMSG_HDR "====" |
30 | #define RAMOOPS_HEADER_SIZE (5 + sizeof(struct timeval)) | 32 | #define RAMOOPS_HEADER_SIZE (5 + sizeof(struct timeval)) |
@@ -91,11 +93,17 @@ static void ramoops_do_dump(struct kmsg_dumper *dumper, | |||
91 | cxt->count = (cxt->count + 1) % cxt->max_count; | 93 | cxt->count = (cxt->count + 1) % cxt->max_count; |
92 | } | 94 | } |
93 | 95 | ||
94 | static int __init ramoops_init(void) | 96 | static int __init ramoops_probe(struct platform_device *pdev) |
95 | { | 97 | { |
98 | struct ramoops_platform_data *pdata = pdev->dev.platform_data; | ||
96 | struct ramoops_context *cxt = &oops_cxt; | 99 | struct ramoops_context *cxt = &oops_cxt; |
97 | int err = -EINVAL; | 100 | int err = -EINVAL; |
98 | 101 | ||
102 | if (pdata) { | ||
103 | mem_size = pdata->mem_size; | ||
104 | mem_address = pdata->mem_address; | ||
105 | } | ||
106 | |||
99 | if (!mem_size) { | 107 | if (!mem_size) { |
100 | printk(KERN_ERR "ramoops: invalid size specification"); | 108 | printk(KERN_ERR "ramoops: invalid size specification"); |
101 | goto fail3; | 109 | goto fail3; |
@@ -142,7 +150,7 @@ fail3: | |||
142 | return err; | 150 | return err; |
143 | } | 151 | } |
144 | 152 | ||
145 | static void __exit ramoops_exit(void) | 153 | static int __exit ramoops_remove(struct platform_device *pdev) |
146 | { | 154 | { |
147 | struct ramoops_context *cxt = &oops_cxt; | 155 | struct ramoops_context *cxt = &oops_cxt; |
148 | 156 | ||
@@ -151,8 +159,26 @@ static void __exit ramoops_exit(void) | |||
151 | 159 | ||
152 | iounmap(cxt->virt_addr); | 160 | iounmap(cxt->virt_addr); |
153 | release_mem_region(cxt->phys_addr, cxt->size); | 161 | release_mem_region(cxt->phys_addr, cxt->size); |
162 | return 0; | ||
154 | } | 163 | } |
155 | 164 | ||
165 | static struct platform_driver ramoops_driver = { | ||
166 | .remove = __exit_p(ramoops_remove), | ||
167 | .driver = { | ||
168 | .name = "ramoops", | ||
169 | .owner = THIS_MODULE, | ||
170 | }, | ||
171 | }; | ||
172 | |||
173 | static int __init ramoops_init(void) | ||
174 | { | ||
175 | return platform_driver_probe(&ramoops_driver, ramoops_probe); | ||
176 | } | ||
177 | |||
178 | static void __exit ramoops_exit(void) | ||
179 | { | ||
180 | platform_driver_unregister(&ramoops_driver); | ||
181 | } | ||
156 | 182 | ||
157 | module_init(ramoops_init); | 183 | module_init(ramoops_init); |
158 | module_exit(ramoops_exit); | 184 | module_exit(ramoops_exit); |