diff options
author | Linus Torvalds <torvalds@g5.osdl.org> | 2005-11-07 13:24:08 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-11-07 13:24:08 -0500 |
commit | b3ce1debe2685383a9ad6ace9c49869c3968c013 (patch) | |
tree | dcb606fac467d6ce78a9c608a1e0d2323af44f2b /drivers/mtd/devices/slram.c | |
parent | 5b2f7ffcb734d3046144dfbd5ac6d76254a9e522 (diff) | |
parent | c2965f1129ee54afcc4ef293ff0f25fa3a7e7392 (diff) |
Merge master.kernel.org:/pub/scm/linux/kernel/git/tglx/mtd-2.6
Some manual fixups for clashing kfree() cleanups etc.
Diffstat (limited to 'drivers/mtd/devices/slram.c')
-rw-r--r-- | drivers/mtd/devices/slram.c | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/drivers/mtd/devices/slram.c b/drivers/mtd/devices/slram.c index 84fa91392a8c..6faee6c6958c 100644 --- a/drivers/mtd/devices/slram.c +++ b/drivers/mtd/devices/slram.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /*====================================================================== | 1 | /*====================================================================== |
2 | 2 | ||
3 | $Id: slram.c,v 1.34 2005/01/06 21:16:42 jwboyer Exp $ | 3 | $Id: slram.c,v 1.36 2005/11/07 11:14:25 gleixner Exp $ |
4 | 4 | ||
5 | This driver provides a method to access memory not used by the kernel | 5 | This driver provides a method to access memory not used by the kernel |
6 | itself (i.e. if the kernel commandline mem=xxx is used). To actually | 6 | itself (i.e. if the kernel commandline mem=xxx is used). To actually |
@@ -18,14 +18,14 @@ | |||
18 | <start>: start of the memory region, decimal or hex (0xabcdef) | 18 | <start>: start of the memory region, decimal or hex (0xabcdef) |
19 | <end/offset>: end of the memory region. It's possible to use +0x1234 | 19 | <end/offset>: end of the memory region. It's possible to use +0x1234 |
20 | to specify the offset instead of the absolute address | 20 | to specify the offset instead of the absolute address |
21 | 21 | ||
22 | NOTE: | 22 | NOTE: |
23 | With slram it's only possible to map a contigous memory region. Therfore | 23 | With slram it's only possible to map a contigous memory region. Therfore |
24 | if there's a device mapped somewhere in the region specified slram will | 24 | if there's a device mapped somewhere in the region specified slram will |
25 | fail to load (see kernel log if modprobe fails). | 25 | fail to load (see kernel log if modprobe fails). |
26 | 26 | ||
27 | - | 27 | - |
28 | 28 | ||
29 | Jochen Schaeuble <psionic@psionic.de> | 29 | Jochen Schaeuble <psionic@psionic.de> |
30 | 30 | ||
31 | ======================================================================*/ | 31 | ======================================================================*/ |
@@ -89,10 +89,10 @@ static int slram_erase(struct mtd_info *mtd, struct erase_info *instr) | |||
89 | if (instr->addr + instr->len > mtd->size) { | 89 | if (instr->addr + instr->len > mtd->size) { |
90 | return(-EINVAL); | 90 | return(-EINVAL); |
91 | } | 91 | } |
92 | 92 | ||
93 | memset(priv->start + instr->addr, 0xff, instr->len); | 93 | memset(priv->start + instr->addr, 0xff, instr->len); |
94 | 94 | ||
95 | /* This'll catch a few races. Free the thing before returning :) | 95 | /* This'll catch a few races. Free the thing before returning :) |
96 | * I don't feel at all ashamed. This kind of thing is possible anyway | 96 | * I don't feel at all ashamed. This kind of thing is possible anyway |
97 | * with flash, but unlikely. | 97 | * with flash, but unlikely. |
98 | */ | 98 | */ |
@@ -170,12 +170,12 @@ static int register_device(char *name, unsigned long start, unsigned long length | |||
170 | } | 170 | } |
171 | (*curmtd)->mtdinfo = kmalloc(sizeof(struct mtd_info), GFP_KERNEL); | 171 | (*curmtd)->mtdinfo = kmalloc(sizeof(struct mtd_info), GFP_KERNEL); |
172 | (*curmtd)->next = NULL; | 172 | (*curmtd)->next = NULL; |
173 | 173 | ||
174 | if ((*curmtd)->mtdinfo) { | 174 | if ((*curmtd)->mtdinfo) { |
175 | memset((char *)(*curmtd)->mtdinfo, 0, sizeof(struct mtd_info)); | 175 | memset((char *)(*curmtd)->mtdinfo, 0, sizeof(struct mtd_info)); |
176 | (*curmtd)->mtdinfo->priv = | 176 | (*curmtd)->mtdinfo->priv = |
177 | kmalloc(sizeof(slram_priv_t), GFP_KERNEL); | 177 | kmalloc(sizeof(slram_priv_t), GFP_KERNEL); |
178 | 178 | ||
179 | if (!(*curmtd)->mtdinfo->priv) { | 179 | if (!(*curmtd)->mtdinfo->priv) { |
180 | kfree((*curmtd)->mtdinfo); | 180 | kfree((*curmtd)->mtdinfo); |
181 | (*curmtd)->mtdinfo = NULL; | 181 | (*curmtd)->mtdinfo = NULL; |
@@ -188,7 +188,7 @@ static int register_device(char *name, unsigned long start, unsigned long length | |||
188 | E("slram: Cannot allocate new MTD device.\n"); | 188 | E("slram: Cannot allocate new MTD device.\n"); |
189 | return(-ENOMEM); | 189 | return(-ENOMEM); |
190 | } | 190 | } |
191 | 191 | ||
192 | if (!(((slram_priv_t *)(*curmtd)->mtdinfo->priv)->start = | 192 | if (!(((slram_priv_t *)(*curmtd)->mtdinfo->priv)->start = |
193 | ioremap(start, length))) { | 193 | ioremap(start, length))) { |
194 | E("slram: ioremap failed\n"); | 194 | E("slram: ioremap failed\n"); |
@@ -223,7 +223,7 @@ static int register_device(char *name, unsigned long start, unsigned long length | |||
223 | T("slram: Mapped from 0x%p to 0x%p\n", | 223 | T("slram: Mapped from 0x%p to 0x%p\n", |
224 | ((slram_priv_t *)(*curmtd)->mtdinfo->priv)->start, | 224 | ((slram_priv_t *)(*curmtd)->mtdinfo->priv)->start, |
225 | ((slram_priv_t *)(*curmtd)->mtdinfo->priv)->end); | 225 | ((slram_priv_t *)(*curmtd)->mtdinfo->priv)->end); |
226 | return(0); | 226 | return(0); |
227 | } | 227 | } |
228 | 228 | ||
229 | static void unregister_devices(void) | 229 | static void unregister_devices(void) |
@@ -256,7 +256,7 @@ static int parse_cmdline(char *devname, char *szstart, char *szlength) | |||
256 | char *buffer; | 256 | char *buffer; |
257 | unsigned long devstart; | 257 | unsigned long devstart; |
258 | unsigned long devlength; | 258 | unsigned long devlength; |
259 | 259 | ||
260 | if ((!devname) || (!szstart) || (!szlength)) { | 260 | if ((!devname) || (!szstart) || (!szlength)) { |
261 | unregister_devices(); | 261 | unregister_devices(); |
262 | return(-EINVAL); | 262 | return(-EINVAL); |
@@ -264,7 +264,7 @@ static int parse_cmdline(char *devname, char *szstart, char *szlength) | |||
264 | 264 | ||
265 | devstart = simple_strtoul(szstart, &buffer, 0); | 265 | devstart = simple_strtoul(szstart, &buffer, 0); |
266 | devstart = handle_unit(devstart, buffer); | 266 | devstart = handle_unit(devstart, buffer); |
267 | 267 | ||
268 | if (*(szlength) != '+') { | 268 | if (*(szlength) != '+') { |
269 | devlength = simple_strtoul(szlength, &buffer, 0); | 269 | devlength = simple_strtoul(szlength, &buffer, 0); |
270 | devlength = handle_unit(devlength, buffer) - devstart; | 270 | devlength = handle_unit(devlength, buffer) - devstart; |
@@ -278,7 +278,7 @@ static int parse_cmdline(char *devname, char *szstart, char *szlength) | |||
278 | E("slram: Illegal start / length parameter.\n"); | 278 | E("slram: Illegal start / length parameter.\n"); |
279 | return(-EINVAL); | 279 | return(-EINVAL); |
280 | } | 280 | } |
281 | 281 | ||
282 | if ((devstart = register_device(devname, devstart, devlength))){ | 282 | if ((devstart = register_device(devname, devstart, devlength))){ |
283 | unregister_devices(); | 283 | unregister_devices(); |
284 | return((int)devstart); | 284 | return((int)devstart); |
@@ -335,7 +335,7 @@ static int init_slram(void) | |||
335 | } | 335 | } |
336 | #else | 336 | #else |
337 | int count; | 337 | int count; |
338 | 338 | ||
339 | for (count = 0; (map[count]) && (count < SLRAM_MAX_DEVICES_PARAMS); | 339 | for (count = 0; (map[count]) && (count < SLRAM_MAX_DEVICES_PARAMS); |
340 | count++) { | 340 | count++) { |
341 | } | 341 | } |
@@ -350,10 +350,10 @@ static int init_slram(void) | |||
350 | if (parse_cmdline(devname, map[i * 3 + 1], map[i * 3 + 2])!=0) { | 350 | if (parse_cmdline(devname, map[i * 3 + 1], map[i * 3 + 2])!=0) { |
351 | return(-EINVAL); | 351 | return(-EINVAL); |
352 | } | 352 | } |
353 | 353 | ||
354 | } | 354 | } |
355 | #endif /* !MODULE */ | 355 | #endif /* !MODULE */ |
356 | 356 | ||
357 | return(0); | 357 | return(0); |
358 | } | 358 | } |
359 | 359 | ||