aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base/platform.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/base/platform.c')
-rw-r--r--drivers/base/platform.c29
1 files changed, 22 insertions, 7 deletions
diff --git a/drivers/base/platform.c b/drivers/base/platform.c
index 4fa954b07ac4..9d2ee25deaf5 100644
--- a/drivers/base/platform.c
+++ b/drivers/base/platform.c
@@ -1000,7 +1000,7 @@ static __initdata LIST_HEAD(early_platform_device_list);
1000int __init early_platform_driver_register(struct early_platform_driver *epdrv, 1000int __init early_platform_driver_register(struct early_platform_driver *epdrv,
1001 char *buf) 1001 char *buf)
1002{ 1002{
1003 unsigned long index; 1003 char *tmp;
1004 int n; 1004 int n;
1005 1005
1006 /* Simply add the driver to the end of the global list. 1006 /* Simply add the driver to the end of the global list.
@@ -1019,13 +1019,28 @@ int __init early_platform_driver_register(struct early_platform_driver *epdrv,
1019 if (buf && !strncmp(buf, epdrv->pdrv->driver.name, n)) { 1019 if (buf && !strncmp(buf, epdrv->pdrv->driver.name, n)) {
1020 list_move(&epdrv->list, &early_platform_driver_list); 1020 list_move(&epdrv->list, &early_platform_driver_list);
1021 1021
1022 if (!strcmp(buf, epdrv->pdrv->driver.name)) 1022 /* Allow passing parameters after device name */
1023 if (buf[n] == '\0' || buf[n] == ',')
1023 epdrv->requested_id = -1; 1024 epdrv->requested_id = -1;
1024 else if (buf[n] == '.' && strict_strtoul(&buf[n + 1], 10, 1025 else {
1025 &index) == 0) 1026 epdrv->requested_id = simple_strtoul(&buf[n + 1],
1026 epdrv->requested_id = index; 1027 &tmp, 10);
1027 else 1028
1028 epdrv->requested_id = EARLY_PLATFORM_ID_ERROR; 1029 if (buf[n] != '.' || (tmp == &buf[n + 1])) {
1030 epdrv->requested_id = EARLY_PLATFORM_ID_ERROR;
1031 n = 0;
1032 } else
1033 n += strcspn(&buf[n + 1], ",") + 1;
1034 }
1035
1036 if (buf[n] == ',')
1037 n++;
1038
1039 if (epdrv->bufsize) {
1040 memcpy(epdrv->buffer, &buf[n],
1041 min_t(int, epdrv->bufsize, strlen(&buf[n]) + 1));
1042 epdrv->buffer[epdrv->bufsize - 1] = '\0';
1043 }
1029 } 1044 }
1030 1045
1031 return 0; 1046 return 0;