From mboxrd@z Thu Jan 1 00:00:00 1970 From: Joe Perches Date: Mon, 13 Sep 2010 20:22:18 +0000 Subject: Re: [PATCH 18/25] drivers/serial/suncore.c: Use static const char Message-Id: <1284409338.26719.47.camel@Joe-Laptop> List-Id: References: <0ab674aa32a5fcc364982c78efdf44864a61523b.1284406639.git.joe@perches.com> <20100913213613.223e10a5@lxorguk.ukuu.org.uk> In-Reply-To: <20100913213613.223e10a5@lxorguk.ukuu.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Alan Cox Cc: linux-kernel@vger.kernel.org, "David S. Miller" , sparclinux@vger.kernel.org On Mon, 2010-09-13 at 21:36 +0100, Alan Cox wrote: > On Mon, 13 Sep 2010 12:47:56 -0700 > Joe Perches wrote: > > diff --git a/drivers/serial/suncore.c b/drivers/serial/suncore.c > > @@ -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 ? There are many cases of char foo[] = "bar" that should be actually be [static] const char foo[] etc. The patch set was done to change those cases. This case isn't actually any sort of saving. As I just wrote in 5/25 to Jonathan Cameron: It tries to standardize the style use and it avoids possible future checkpatch warnings of: char foo[] = "bar" char array could possibly be static const. There was another use with "%1.1d" somewhere. The end result is the same, so I don't really care much if this sort of change is applied or not. The possible checkpatch message could just be considered noise but Mike Frysinger seemed to prefer it, so I thought I could try to accommodate him. cheers, Joe From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754458Ab0IMUWW (ORCPT ); Mon, 13 Sep 2010 16:22:22 -0400 Received: from mail.perches.com ([173.55.12.10]:1951 "EHLO mail.perches.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751848Ab0IMUWV (ORCPT ); Mon, 13 Sep 2010 16:22:21 -0400 Subject: Re: [PATCH 18/25] drivers/serial/suncore.c: Use static const char arrays From: Joe Perches To: Alan Cox Cc: linux-kernel@vger.kernel.org, "David S. Miller" , sparclinux@vger.kernel.org In-Reply-To: <20100913213613.223e10a5@lxorguk.ukuu.org.uk> References: <0ab674aa32a5fcc364982c78efdf44864a61523b.1284406639.git.joe@perches.com> <20100913213613.223e10a5@lxorguk.ukuu.org.uk> Content-Type: text/plain; charset="UTF-8" Date: Mon, 13 Sep 2010 13:22:18 -0700 Message-ID: <1284409338.26719.47.camel@Joe-Laptop> Mime-Version: 1.0 X-Mailer: Evolution 2.30.3 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 2010-09-13 at 21:36 +0100, Alan Cox wrote: > On Mon, 13 Sep 2010 12:47:56 -0700 > Joe Perches wrote: > > diff --git a/drivers/serial/suncore.c b/drivers/serial/suncore.c > > @@ -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 ? There are many cases of char foo[] = "bar" that should be actually be [static] const char foo[] etc. The patch set was done to change those cases. This case isn't actually any sort of saving. As I just wrote in 5/25 to Jonathan Cameron: It tries to standardize the style use and it avoids possible future checkpatch warnings of: char foo[] = "bar" char array could possibly be static const. There was another use with "%1.1d" somewhere. The end result is the same, so I don't really care much if this sort of change is applied or not. The possible checkpatch message could just be considered noise but Mike Frysinger seemed to prefer it, so I thought I could try to accommodate him. cheers, Joe