From mboxrd@z Thu Jan 1 00:00:00 1970 From: Joe Perches Subject: Re: [PATCH 05/25] drivers/i2c: Use static const char arrays Date: Mon, 13 Sep 2010 13:16:07 -0700 Message-ID: <1284408967.26719.36.camel@Joe-Laptop> References: <4C8E84A0.1010606@jic23.retrosnub.co.uk> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <4C8E84A0.1010606-tko9wxEg+fIOOJlXag/Snyp2UmYkHbXO@public.gmane.org> Sender: linux-i2c-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: Jonathan Cameron Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, "Jean Delvare (PC drivers, core)" , linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Linus Walleij , "Ben Dooks (embedded platforms)" , linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org List-Id: linux-i2c@vger.kernel.org On Mon, 2010-09-13 at 21:08 +0100, Jonathan Cameron wrote: > Commit message is somewhat inaccurate... Yeah, sorry 'bout that. That's what I get for using a script. I did write an intro with more complete description. > > diff --git a/drivers/i2c/busses/i2c-stu300.c b/drivers/i2c/busses/i2c-stu300.c > > @@ -881,7 +881,7 @@ stu300_probe(struct platform_device *pdev) > > } > > > > bus_nr = pdev->id; > > - clk_name[3] += (char)bus_nr; > > + sprintf(clk_name, "I2C%c", '0' + bus_nr); > I'm guessing that there are never more than a couple of these. > Why is this method a better bet than just putting %d? 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 From: joe@perches.com (Joe Perches) Date: Mon, 13 Sep 2010 13:16:07 -0700 Subject: [PATCH 05/25] drivers/i2c: Use static const char arrays In-Reply-To: <4C8E84A0.1010606@jic23.retrosnub.co.uk> References: <4C8E84A0.1010606@jic23.retrosnub.co.uk> Message-ID: <1284408967.26719.36.camel@Joe-Laptop> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org On Mon, 2010-09-13 at 21:08 +0100, Jonathan Cameron wrote: > Commit message is somewhat inaccurate... Yeah, sorry 'bout that. That's what I get for using a script. I did write an intro with more complete description. > > diff --git a/drivers/i2c/busses/i2c-stu300.c b/drivers/i2c/busses/i2c-stu300.c > > @@ -881,7 +881,7 @@ stu300_probe(struct platform_device *pdev) > > } > > > > bus_nr = pdev->id; > > - clk_name[3] += (char)bus_nr; > > + sprintf(clk_name, "I2C%c", '0' + bus_nr); > I'm guessing that there are never more than a couple of these. > Why is this method a better bet than just putting %d? 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 S1754959Ab0IMUQK (ORCPT ); Mon, 13 Sep 2010 16:16:10 -0400 Received: from mail.perches.com ([173.55.12.10]:1944 "EHLO mail.perches.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755603Ab0IMUQI (ORCPT ); Mon, 13 Sep 2010 16:16:08 -0400 Subject: Re: [PATCH 05/25] drivers/i2c: Use static const char arrays From: Joe Perches To: Jonathan Cameron Cc: linux-kernel@vger.kernel.org, "Jean Delvare (PC drivers, core)" , linux-i2c@vger.kernel.org, Linus Walleij , "Ben Dooks (embedded platforms)" , linux-arm-kernel@lists.infradead.org In-Reply-To: <4C8E84A0.1010606@jic23.retrosnub.co.uk> References: <4C8E84A0.1010606@jic23.retrosnub.co.uk> Content-Type: text/plain; charset="UTF-8" Date: Mon, 13 Sep 2010 13:16:07 -0700 Message-ID: <1284408967.26719.36.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:08 +0100, Jonathan Cameron wrote: > Commit message is somewhat inaccurate... Yeah, sorry 'bout that. That's what I get for using a script. I did write an intro with more complete description. > > diff --git a/drivers/i2c/busses/i2c-stu300.c b/drivers/i2c/busses/i2c-stu300.c > > @@ -881,7 +881,7 @@ stu300_probe(struct platform_device *pdev) > > } > > > > bus_nr = pdev->id; > > - clk_name[3] += (char)bus_nr; > > + sprintf(clk_name, "I2C%c", '0' + bus_nr); > I'm guessing that there are never more than a couple of these. > Why is this method a better bet than just putting %d? 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