linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: eduardo.valentin@nokia.com (Eduardo Valentin)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCHv2 2/4] mach-omap2: Add SoC info data for OMAP2,3,4 into /proc/cpuinfo
Date: Wed, 28 Apr 2010 08:43:34 +0300	[thread overview]
Message-ID: <20100428054334.GD332@besouro.research.nokia.com> (raw)
In-Reply-To: <20100427150129.GA8600@nokia.com>

On Tue, Apr 27, 2010 at 05:01:30PM +0200, Balbi Felipe (Nokia-D/Helsinki) wrote:
> On Tue, Apr 27, 2010 at 03:14:13PM +0200, Valentin Eduardo (Nokia-D/Helsinki) wrote:
> >From: Eduardo Valentin <eduardo.valentin@nokia.com>
> >
> >Report OMAP2,3,4 data into system_soc_info. Now we get omap
> >information under /proc/cpuinfo.
> >
> >Signed-off-by: Eduardo Valentin <eduardo.valentin@nokia.com>
> >---
> > arch/arm/mach-omap2/id.c |   21 +++++++++++++++------
> > 1 files changed, 15 insertions(+), 6 deletions(-)
> >
> >diff --git a/arch/arm/mach-omap2/id.c b/arch/arm/mach-omap2/id.c
> >index 37b8a1a..75e36a5 100644
> >--- a/arch/arm/mach-omap2/id.c
> >+++ b/arch/arm/mach-omap2/id.c
> >@@ -152,10 +152,15 @@ void __init omap24xx_check_revision(void)
> > 		j = i;
> > 	}
> >
> >-	pr_info("OMAP%04x", omap_rev() >> 16);
> >-	if ((omap_rev() >> 8) & 0x0f)
> >-		pr_info("ES%x", (omap_rev() >> 12) & 0xf);
> >-	pr_info("\n");
> >+	snprintf(system_soc_info, SYSTEM_SOC_INFO_SIZE, "OMAP%04x",
> >+							omap_rev() >> 16);
> >+	if ((omap_rev() >> 8) & 0x0f) {
> >+		int sz = strlen(system_soc_info);
> 
> how about you use the return of the first snprintf instead of asking 
> strlen() here ? I mean:

Yeah,

> 
> int sz = snprintf(system_soc_info, SYSTEM_SOC_INFO_SIZE, "OMAP%04x",
> 		omap_rev() >> 16);
> 
> if ((omap_rev() >> 8) & 0x0f)
> 	snprintf(system_soc_info + sz, SYSTEM_SOC_INFO_SIZE - sz,
> 			"ES%x", (omap_rev() >> 12) & 0x0f);
> 
> would that work ???

I think so, yeah. No need to recompute the string length twice. Will resend soon.

> 
> -- 
> balbi
> 
> DefectiveByDesign.org
> --
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majordomo at vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2010-04-28  5:43 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-27 13:14 [PATCHv2 0/4] Adding soc related info into /proc/cpuinfo Eduardo Valentin
2010-04-27 13:14 ` [PATCHv2 1/4] ARM: Introduce SoC Info " Eduardo Valentin
2010-04-27 13:14 ` [PATCHv2 2/4] mach-omap2: Add SoC info data for OMAP2, 3, 4 " Eduardo Valentin
2010-04-27 15:01   ` [PATCHv2 2/4] mach-omap2: Add SoC info data for OMAP2,3,4 " Felipe Balbi
2010-04-28  5:43     ` Eduardo Valentin [this message]
2010-04-27 13:14 ` [PATCHv2 3/4] mach-omap1: Add SoC info data for OMAP1 " Eduardo Valentin
2010-04-27 13:14 ` [PATCHv2 4/4] OMAP3: PM: export chip IDCODE, Production ID and Die ID Eduardo Valentin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100428054334.GD332@besouro.research.nokia.com \
    --to=eduardo.valentin@nokia.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).