aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/devices/phram.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mtd/devices/phram.c')
-rw-r--r--drivers/mtd/devices/phram.c25
1 files changed, 12 insertions, 13 deletions
diff --git a/drivers/mtd/devices/phram.c b/drivers/mtd/devices/phram.c
index 088fbb7595b5..1696bbecaa7e 100644
--- a/drivers/mtd/devices/phram.c
+++ b/drivers/mtd/devices/phram.c
@@ -14,6 +14,9 @@
14 * Example: 14 * Example:
15 * phram=swap,64Mi,128Mi phram=test,900Mi,1Mi 15 * phram=swap,64Mi,128Mi phram=test,900Mi,1Mi
16 */ 16 */
17
18#define pr_fmt(fmt) "phram: " fmt
19
17#include <asm/io.h> 20#include <asm/io.h>
18#include <linux/init.h> 21#include <linux/init.h>
19#include <linux/kernel.h> 22#include <linux/kernel.h>
@@ -23,8 +26,6 @@
23#include <linux/slab.h> 26#include <linux/slab.h>
24#include <linux/mtd/mtd.h> 27#include <linux/mtd/mtd.h>
25 28
26#define ERROR(fmt, args...) printk(KERN_ERR "phram: " fmt , ## args)
27
28struct phram_mtd_list { 29struct phram_mtd_list {
29 struct mtd_info mtd; 30 struct mtd_info mtd;
30 struct list_head list; 31 struct list_head list;
@@ -132,7 +133,7 @@ static int register_device(char *name, unsigned long start, unsigned long len)
132 ret = -EIO; 133 ret = -EIO;
133 new->mtd.priv = ioremap(start, len); 134 new->mtd.priv = ioremap(start, len);
134 if (!new->mtd.priv) { 135 if (!new->mtd.priv) {
135 ERROR("ioremap failed\n"); 136 pr_err("ioremap failed\n");
136 goto out1; 137 goto out1;
137 } 138 }
138 139
@@ -152,7 +153,7 @@ static int register_device(char *name, unsigned long start, unsigned long len)
152 153
153 ret = -EAGAIN; 154 ret = -EAGAIN;
154 if (add_mtd_device(&new->mtd)) { 155 if (add_mtd_device(&new->mtd)) {
155 ERROR("Failed to register new device\n"); 156 pr_err("Failed to register new device\n");
156 goto out2; 157 goto out2;
157 } 158 }
158 159
@@ -227,8 +228,8 @@ static inline void kill_final_newline(char *str)
227 228
228 229
229#define parse_err(fmt, args...) do { \ 230#define parse_err(fmt, args...) do { \
230 ERROR(fmt , ## args); \ 231 pr_err(fmt , ## args); \
231 return 0; \ 232 return 1; \
232} while (0) 233} while (0)
233 234
234static int phram_setup(const char *val, struct kernel_param *kp) 235static int phram_setup(const char *val, struct kernel_param *kp)
@@ -256,12 +257,8 @@ static int phram_setup(const char *val, struct kernel_param *kp)
256 parse_err("not enough arguments\n"); 257 parse_err("not enough arguments\n");
257 258
258 ret = parse_name(&name, token[0]); 259 ret = parse_name(&name, token[0]);
259 if (ret == -ENOMEM)
260 parse_err("out of memory\n");
261 if (ret == -ENOSPC)
262 parse_err("name too long\n");
263 if (ret) 260 if (ret)
264 return 0; 261 return ret;
265 262
266 ret = parse_num32(&start, token[1]); 263 ret = parse_num32(&start, token[1]);
267 if (ret) { 264 if (ret) {
@@ -275,9 +272,11 @@ static int phram_setup(const char *val, struct kernel_param *kp)
275 parse_err("illegal device length\n"); 272 parse_err("illegal device length\n");
276 } 273 }
277 274
278 register_device(name, start, len); 275 ret = register_device(name, start, len);
276 if (!ret)
277 pr_info("%s device: %#x at %#x\n", name, len, start);
279 278
280 return 0; 279 return ret;
281} 280}
282 281
283module_param_call(phram, phram_setup, NULL, NULL, 000); 282module_param_call(phram, phram_setup, NULL, NULL, 000);