aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base
diff options
context:
space:
mode:
authorMagnus Damm <damm@opensource.se>2009-11-27 03:38:51 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2009-12-11 14:24:55 -0500
commitc60e0504c8e4fa14179d0687d80ef25148dd6dd4 (patch)
tree01e8ba58e367cb6bd2ae4ee334265e5bd2800769 /drivers/base
parente16acb503b42ef241a9396de7c5a1614c74d8ca6 (diff)
Driver Core: Early platform driver buffer
Add early_platform_init_buffer() support and update the early platform driver code to allow passing parameters to the driver on the kernel command line. early_platform_init_buffer() simply allows early platform drivers to provide a pointer and length to a memory area where the remaining part of the kernel command line option will be stored. Needed to pass baud rate and other serial port options to the reworked early serial console code on SuperH. Signed-off-by: Magnus Damm <damm@opensource.se> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/base')
-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;