diff options
author | Dmitry Torokhov <dtor@insightbb.com> | 2006-08-04 22:50:27 -0400 |
---|---|---|
committer | Dmitry Torokhov <dtor@insightbb.com> | 2006-08-04 22:50:27 -0400 |
commit | d932cb7e630cae3b6b5307b767d296ff1a597c5e (patch) | |
tree | f930d068a12a256fabef0864bcdf8e85f095369e /drivers/s390/block/xpram.c | |
parent | 73b59a3b1c09e4bfc678400b77b96134dcfbf112 (diff) | |
parent | f5d635f649607b09b0b4620d25d028fd2b1b7ea5 (diff) |
Merge rsync://rsync.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6 into for-linus
Diffstat (limited to 'drivers/s390/block/xpram.c')
-rw-r--r-- | drivers/s390/block/xpram.c | 74 |
1 files changed, 17 insertions, 57 deletions
diff --git a/drivers/s390/block/xpram.c b/drivers/s390/block/xpram.c index 4c1e56b9b98d..1140302ff11d 100644 --- a/drivers/s390/block/xpram.c +++ b/drivers/s390/block/xpram.c | |||
@@ -71,11 +71,11 @@ static int xpram_devs; | |||
71 | /* | 71 | /* |
72 | * Parameter parsing functions. | 72 | * Parameter parsing functions. |
73 | */ | 73 | */ |
74 | static int devs = XPRAM_DEVS; | 74 | static int __initdata devs = XPRAM_DEVS; |
75 | static unsigned int sizes[XPRAM_MAX_DEVS]; | 75 | static char __initdata *sizes[XPRAM_MAX_DEVS]; |
76 | 76 | ||
77 | module_param(devs, int, 0); | 77 | module_param(devs, int, 0); |
78 | module_param_array(sizes, int, NULL, 0); | 78 | module_param_array(sizes, charp, NULL, 0); |
79 | 79 | ||
80 | MODULE_PARM_DESC(devs, "number of devices (\"partitions\"), " \ | 80 | MODULE_PARM_DESC(devs, "number of devices (\"partitions\"), " \ |
81 | "the default is " __MODULE_STRING(XPRAM_DEVS) "\n"); | 81 | "the default is " __MODULE_STRING(XPRAM_DEVS) "\n"); |
@@ -86,59 +86,6 @@ MODULE_PARM_DESC(sizes, "list of device (partition) sizes " \ | |||
86 | "claimed by explicit sizes\n"); | 86 | "claimed by explicit sizes\n"); |
87 | MODULE_LICENSE("GPL"); | 87 | MODULE_LICENSE("GPL"); |
88 | 88 | ||
89 | #ifndef MODULE | ||
90 | /* | ||
91 | * Parses the kernel parameters given in the kernel parameter line. | ||
92 | * The expected format is | ||
93 | * <number_of_partitions>[","<partition_size>]* | ||
94 | * where | ||
95 | * devices is a positive integer that initializes xpram_devs | ||
96 | * each size is a non-negative integer possibly followed by a | ||
97 | * magnitude (k,K,m,M,g,G), the list of sizes initialises | ||
98 | * xpram_sizes | ||
99 | * | ||
100 | * Arguments | ||
101 | * str: substring of kernel parameter line that contains xprams | ||
102 | * kernel parameters. | ||
103 | * | ||
104 | * Result 0 on success, -EINVAL else -- only for Version > 2.3 | ||
105 | * | ||
106 | * Side effects | ||
107 | * the global variabls devs is set to the value of | ||
108 | * <number_of_partitions> and sizes[i] is set to the i-th | ||
109 | * partition size (if provided). A parsing error of a value | ||
110 | * results in this value being set to -EINVAL. | ||
111 | */ | ||
112 | static int __init xpram_setup (char *str) | ||
113 | { | ||
114 | char *cp; | ||
115 | int i; | ||
116 | |||
117 | devs = simple_strtoul(str, &cp, 10); | ||
118 | if (cp <= str || devs > XPRAM_MAX_DEVS) | ||
119 | return 0; | ||
120 | for (i = 0; (i < devs) && (*cp++ == ','); i++) { | ||
121 | sizes[i] = simple_strtoul(cp, &cp, 10); | ||
122 | if (*cp == 'g' || *cp == 'G') { | ||
123 | sizes[i] <<= 20; | ||
124 | cp++; | ||
125 | } else if (*cp == 'm' || *cp == 'M') { | ||
126 | sizes[i] <<= 10; | ||
127 | cp++; | ||
128 | } else if (*cp == 'k' || *cp == 'K') | ||
129 | cp++; | ||
130 | while (isspace(*cp)) cp++; | ||
131 | } | ||
132 | if (*cp == ',' && i >= devs) | ||
133 | PRINT_WARN("partition sizes list has too many entries.\n"); | ||
134 | else if (*cp != 0) | ||
135 | PRINT_WARN("ignored '%s' at end of parameter string.\n", cp); | ||
136 | return 1; | ||
137 | } | ||
138 | |||
139 | __setup("xpram_parts=", xpram_setup); | ||
140 | #endif | ||
141 | |||
142 | /* | 89 | /* |
143 | * Copy expanded memory page (4kB) into main memory | 90 | * Copy expanded memory page (4kB) into main memory |
144 | * Arguments | 91 | * Arguments |
@@ -357,6 +304,7 @@ static int __init xpram_setup_sizes(unsigned long pages) | |||
357 | { | 304 | { |
358 | unsigned long mem_needed; | 305 | unsigned long mem_needed; |
359 | unsigned long mem_auto; | 306 | unsigned long mem_auto; |
307 | unsigned long long size; | ||
360 | int mem_auto_no; | 308 | int mem_auto_no; |
361 | int i; | 309 | int i; |
362 | 310 | ||
@@ -374,7 +322,19 @@ static int __init xpram_setup_sizes(unsigned long pages) | |||
374 | mem_needed = 0; | 322 | mem_needed = 0; |
375 | mem_auto_no = 0; | 323 | mem_auto_no = 0; |
376 | for (i = 0; i < xpram_devs; i++) { | 324 | for (i = 0; i < xpram_devs; i++) { |
377 | xpram_sizes[i] = (sizes[i] + 3) & -4UL; | 325 | if (sizes[i]) { |
326 | size = simple_strtoull(sizes[i], &sizes[i], 0); | ||
327 | switch (sizes[i][0]) { | ||
328 | case 'g': | ||
329 | case 'G': | ||
330 | size <<= 20; | ||
331 | break; | ||
332 | case 'm': | ||
333 | case 'M': | ||
334 | size <<= 10; | ||
335 | } | ||
336 | xpram_sizes[i] = (size + 3) & -4UL; | ||
337 | } | ||
378 | if (xpram_sizes[i]) | 338 | if (xpram_sizes[i]) |
379 | mem_needed += xpram_sizes[i]; | 339 | mem_needed += xpram_sizes[i]; |
380 | else | 340 | else |