Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1670876

[PATCH v2 06/17] serial: core: Make uart_parse_options take const char* argument

From Paul Cercueil <paul@crapouillou.net>
Newsgroups linux.kernel
Subject [PATCH v2 06/17] serial: core: Make uart_parse_options take const char* argument
Date 2017-06-20 17:30 +0200
Message-ID <tUtgn-1UJ-51@gated-at.bofh.it> (permalink)
References <tPPrd-2PB-43@gated-at.bofh.it> <tUt6F-1QX-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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>
---
 drivers/tty/serial/serial_core.c | 5 +++--
 include/linux/serial_core.h      | 2 +-
 2 files changed, 4 insertions(+), 3 deletions(-)

 v2: New patch in this series

diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
index 13bfd5dcffce..95d3770bdb37 100644
--- a/drivers/tty/serial/serial_core.c
+++ b/drivers/tty/serial/serial_core.c
@@ -1954,9 +1954,10 @@ EXPORT_SYMBOL_GPL(uart_parse_earlycon);
  *	eg: 115200n8r
  */
 void
-uart_parse_options(char *options, int *baud, int *parity, int *bits, int *flow)
+uart_parse_options(const char *options, int *baud, int *parity,
+		   int *bits, int *flow)
 {
-	char *s = options;
+	const char *s = options;
 
 	*baud = simple_strtoul(s, NULL, 10);
 	while (*s >= '0' && *s <= '9')
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index 64d892f1e5cd..67f88fb53195 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -386,7 +386,7 @@ struct uart_port *uart_get_console(struct uart_port *ports, int nr,
 				   struct console *c);
 int uart_parse_earlycon(char *p, unsigned char *iotype, resource_size_t *addr,
 			char **options);
-void uart_parse_options(char *options, int *baud, int *parity, int *bits,
+void uart_parse_options(const char *options, int *baud, int *parity, int *bits,
 			int *flow);
 int uart_set_options(struct uart_port *port, struct console *co, int baud,
 		     int parity, int bits, int flow);
-- 
2.11.0

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v2 01/17] clk: ingenic: Use const pointer to clk_ops in struct Paul Cercueil <paul@crapouillou.net> - 2017-06-20 17:30 +0200
  [PATCH v2 08/17] serial: 8250_ingenic: Parse earlycon options Paul Cercueil <paul@crapouillou.net> - 2017-06-20 17:30 +0200
  [PATCH v2 15/17] MIPS: JZ4770: Workaround for corrupted DMA transfers Paul Cercueil <paul@crapouillou.net> - 2017-06-20 17:30 +0200
    Re: [PATCH v2 15/17] MIPS: JZ4770: Workaround for corrupted DMA  transfers Marcin Nowakowski <marcin.nowakowski@imgtec.com> - 2017-06-22 09:30 +0200
      Re: [PATCH v2 15/17] MIPS: JZ4770: Workaround for corrupted DMA  transfers Paul Cercueil <paul@crapouillou.net> - 2017-06-26 15:40 +0200
  [PATCH v2 03/17] clk: ingenic: support PLLs with no bypass bit Paul Cercueil <paul@crapouillou.net> - 2017-06-20 17:30 +0200
  [PATCH v2 07/17] serial: 8250_ingenic: Add support for the JZ4770 SoC Paul Cercueil <paul@crapouillou.net> - 2017-06-20 17:30 +0200
  [PATCH v2 06/17] serial: core: Make uart_parse_options take const char* argument Paul Cercueil <paul@crapouillou.net> - 2017-06-20 17:30 +0200
  [PATCH v2 05/17] clk: Add Ingenic jz4770 CGU driver Paul Cercueil <paul@crapouillou.net> - 2017-06-20 17:30 +0200
  [PATCH v2 16/17] devicetree/bindings: Add GCW vendor prefix Paul Cercueil <paul@crapouillou.net> - 2017-06-20 17:30 +0200
  Re: [PATCH v2 01/17] clk: ingenic: Use const pointer to clk_ops in  struct Stephen Boyd <sboyd@codeaurora.org> - 2017-06-22 00:00 +0200
    Re: [PATCH v2 01/17] clk: ingenic: Use const pointer to clk_ops in  struct Paul Cercueil <paul@crapouillou.net> - 2017-06-26 15:50 +0200

csiph-web