Commit 09762dcb authored by Jan Höppner's avatar Jan Höppner Committed by Martin Schwidefsky

s390/dasd: Always store parameter elements in an array

When the DASD driver is built into the kernel, the entire comma
separated parameter list is stored as one single element in the dasd[]
array, opposed to the module build where each element is stored
separately in dasd[].
There is no point in doing so. Therefore, store each part of the list as
single elements in dasd[] as well when built into the kernel.
Also, create a define for the maximum of 256 parameters.
Reviewed-by: default avatarStefan Haberland <sth@linux.vnet.ibm.com>
Reviewed-by: default avatarSebastian Ott <sebott@linux.vnet.ibm.com>
Signed-off-by: default avatarJan Höppner <hoeppner@linux.vnet.ibm.com>
Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
parent 7fbe5c0f
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
/* This is ugly... */ /* This is ugly... */
#define PRINTK_HEADER "dasd_devmap:" #define PRINTK_HEADER "dasd_devmap:"
#define DASD_BUS_ID_SIZE 20 #define DASD_BUS_ID_SIZE 20
#define DASD_MAX_PARAMS 256
#include "dasd_int.h" #include "dasd_int.h"
...@@ -76,7 +77,7 @@ EXPORT_SYMBOL_GPL(dasd_nofcx); ...@@ -76,7 +77,7 @@ EXPORT_SYMBOL_GPL(dasd_nofcx);
* it is named 'dasd' to directly be filled by insmod with the comma separated * it is named 'dasd' to directly be filled by insmod with the comma separated
* strings when running as a module. * strings when running as a module.
*/ */
static char *dasd[256]; static char *dasd[DASD_MAX_PARAMS];
module_param_array(dasd, charp, NULL, S_IRUGO); module_param_array(dasd, charp, NULL, S_IRUGO);
/* /*
...@@ -104,18 +105,19 @@ dasd_hash_busid(const char *bus_id) ...@@ -104,18 +105,19 @@ dasd_hash_busid(const char *bus_id)
} }
#ifndef MODULE #ifndef MODULE
/* static int __init dasd_call_setup(char *opt)
* The parameter parsing functions for builtin-drivers are called
* before kmalloc works. Store the pointers to the parameters strings
* into dasd[] for later processing.
*/
static int __init
dasd_call_setup(char *str)
{ {
static int count = 0; static int i;
char *tmp;
while (i < DASD_MAX_PARAMS) {
tmp = strsep(&opt, ",");
if (!tmp)
break;
dasd[i++] = tmp;
}
if (count < 256)
dasd[count++] = str;
return 1; return 1;
} }
...@@ -364,10 +366,8 @@ dasd_parse_next_element( char *parsestring ) { ...@@ -364,10 +366,8 @@ dasd_parse_next_element( char *parsestring ) {
/* /*
* Parse parameters stored in dasd[] * Parse parameters stored in dasd[]
* The 'dasd=...' parameter allows to specify a comma separated list of * The 'dasd=...' parameter allows to specify a comma separated list of
* keywords and device ranges. When the dasd driver is build into the kernel, * keywords and device ranges. The parameters in that list will be stored as
* the complete list will be stored as one element of the dasd[] array. * separate elementes in dasd[].
* When the dasd driver is build as a module, then the list is broken into
* it's elements and each dasd[] entry contains one element.
*/ */
int int
dasd_parse(void) dasd_parse(void)
...@@ -376,7 +376,7 @@ dasd_parse(void) ...@@ -376,7 +376,7 @@ dasd_parse(void)
char *parsestring; char *parsestring;
rc = 0; rc = 0;
for (i = 0; i < 256; i++) { for (i = 0; i < DASD_MAX_PARAMS; i++) {
if (dasd[i] == NULL) if (dasd[i] == NULL)
break; break;
parsestring = dasd[i]; parsestring = dasd[i];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment