aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Cercueil <paul@crapouillou.net>2017-12-28 08:07:07 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-01-09 10:46:26 -0500
commit0f646b63a1b2ede7885e45cf6e986128e001f91b (patch)
tree9f865b1743aeffb8148473f24515633838b27577
parentb9820a31691b771db37afe2054dd3d3a680c1eed (diff)
serial: core: Make uart_parse_options take const char* argument
The pointed string is never modified from within uart_parse_options, so it should be marked as const in the function prototype. Signed-off-by: Paul Cercueil <paul@crapouillou.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/tty/serial/serial_core.c5
-rw-r--r--include/linux/serial_core.h2
2 files changed, 4 insertions, 3 deletions
diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
index f57969de2f1c..2148883db66d 100644
--- a/drivers/tty/serial/serial_core.c
+++ b/drivers/tty/serial/serial_core.c
@@ -1955,9 +1955,10 @@ EXPORT_SYMBOL_GPL(uart_parse_earlycon);
1955 * eg: 115200n8r 1955 * eg: 115200n8r
1956 */ 1956 */
1957void 1957void
1958uart_parse_options(char *options, int *baud, int *parity, int *bits, int *flow) 1958uart_parse_options(const char *options, int *baud, int *parity,
1959 int *bits, int *flow)
1959{ 1960{
1960 char *s = options; 1961 const char *s = options;
1961 1962
1962 *baud = simple_strtoul(s, NULL, 10); 1963 *baud = simple_strtoul(s, NULL, 10);
1963 while (*s >= '0' && *s <= '9') 1964 while (*s >= '0' && *s <= '9')
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index b60b225c0a59..4c310c34ddad 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -387,7 +387,7 @@ struct uart_port *uart_get_console(struct uart_port *ports, int nr,
387 struct console *c); 387 struct console *c);
388int uart_parse_earlycon(char *p, unsigned char *iotype, resource_size_t *addr, 388int uart_parse_earlycon(char *p, unsigned char *iotype, resource_size_t *addr,
389 char **options); 389 char **options);
390void uart_parse_options(char *options, int *baud, int *parity, int *bits, 390void uart_parse_options(const char *options, int *baud, int *parity, int *bits,
391 int *flow); 391 int *flow);
392int uart_set_options(struct uart_port *port, struct console *co, int baud, 392int uart_set_options(struct uart_port *port, struct console *co, int baud,
393 int parity, int bits, int flow); 393 int parity, int bits, int flow);