diff options
-rw-r--r-- | drivers/s390/block/xpram.c | 63 |
1 files changed, 6 insertions, 57 deletions
diff --git a/drivers/s390/block/xpram.c b/drivers/s390/block/xpram.c index 4c1e56b9b98d..4cd879cb9bdd 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 |
@@ -374,7 +321,9 @@ static int __init xpram_setup_sizes(unsigned long pages) | |||
374 | mem_needed = 0; | 321 | mem_needed = 0; |
375 | mem_auto_no = 0; | 322 | mem_auto_no = 0; |
376 | for (i = 0; i < xpram_devs; i++) { | 323 | for (i = 0; i < xpram_devs; i++) { |
377 | xpram_sizes[i] = (sizes[i] + 3) & -4UL; | 324 | if (sizes[i]) |
325 | xpram_sizes[i] = | ||
326 | (memparse(sizes[i], &sizes[i]) + 3) & -4UL; | ||
378 | if (xpram_sizes[i]) | 327 | if (xpram_sizes[i]) |
379 | mem_needed += xpram_sizes[i]; | 328 | mem_needed += xpram_sizes[i]; |
380 | else | 329 | else |