Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 298167
b: refs/heads/master
c: b2a2a84
h: refs/heads/master
i:
  298165: a383b21
  298163: df734b6
  298159: 1372475
v: v3
  • Loading branch information
Hervé Fache authored and David Woodhouse committed Mar 26, 2012
1 parent 8f1cab0 commit 51cf84d
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 4 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: 09ef90d965fff295da8d5359ac21e54c02236dba
refs/heads/master: b2a2a84d35e0f42ad26e326ec4258f6a8b8eecbe
33 changes: 30 additions & 3 deletions trunk/drivers/mtd/devices/phram.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ static int phram_erase(struct mtd_info *mtd, struct erase_info *instr)

memset(start + instr->addr, 0xff, instr->len);

/* This'll catch a few races. Free the thing before returning :)
/*
* This'll catch a few races. Free the thing before returning :)
* I don't feel at all ashamed. This kind of thing is possible anyway
* with flash, but unlikely.
*/
Expand Down Expand Up @@ -204,7 +205,17 @@ static inline void kill_final_newline(char *str)
return 1; \
} while (0)

static int phram_setup(const char *val, struct kernel_param *kp)
/*
* This shall contain the module parameter if any. It is of the form:
* - phram=<device>,<address>,<size> for module case
* - phram.phram=<device>,<address>,<size> for built-in case
* We leave 64 bytes for the device name, 12 for the address and 12 for the
* size.
* Example: phram.phram=rootfs,0xa0000000,512Mi
*/
static __initdata char phram_paramline[64+12+12];

static int phram_setup(const char *val)
{
char buf[64+12+12], *str = buf;
char *token[3];
Expand Down Expand Up @@ -253,12 +264,28 @@ static int phram_setup(const char *val, struct kernel_param *kp)
return ret;
}

module_param_call(phram, phram_setup, NULL, NULL, 000);
static int __init phram_param_call(const char *val, struct kernel_param *kp)
{
/*
* This function is always called before 'init_phram()', whether
* built-in or module.
*/
if (strlen(val) >= sizeof(phram_paramline))
return -ENOSPC;
strcpy(phram_paramline, val);

return 0;
}

module_param_call(phram, phram_param_call, NULL, NULL, 000);
MODULE_PARM_DESC(phram, "Memory region to map. \"phram=<name>,<start>,<length>\"");


static int __init init_phram(void)
{
if (phram_paramline[0])
return phram_setup(phram_paramline);

return 0;
}

Expand Down

0 comments on commit 51cf84d

Please sign in to comment.