Re: [PATCH 18/25] drivers/serial/suncore.c: Use static const chararrays

From: Alan Cox
Date: Mon Sep 13 2010 - 16:16:31 EST


On Mon, 13 Sep 2010 12:47:56 -0700
Joe Perches <joe@xxxxxxxxxxx> wrote:

> Signed-off-by: Joe Perches <joe@xxxxxxxxxxx>
> ---
> drivers/serial/suncore.c | 4 ++--
> 1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/serial/suncore.c b/drivers/serial/suncore.c
> index 6381a02..f2a5b54 100644
> --- a/drivers/serial/suncore.c
> +++ b/drivers/serial/suncore.c
> @@ -84,8 +84,8 @@ EXPORT_SYMBOL(sunserial_console_match);
>
> void sunserial_console_termios(struct console *con, struct device_node *uart_dp)
> {
> + char mode_prop[sizeof("ttyX-mode")];
> const char *mode, *s;
> - char mode_prop[] = "ttyX-mode";
> int baud, bits, stop, cflag;
> char parity;
>
> @@ -106,7 +106,7 @@ void sunserial_console_termios(struct console *con, struct device_node *uart_dp)
> if (of_console_options)
> c = *of_console_options;
>
> - mode_prop[3] = c;
> + sprintf(mode_prop, "tty%c-mode", c);

Whats the point of all this. It's trivial code being replaced by
something complicated, harder to understand and much slower ?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/