public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Wolfgang Denk <wd@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] [v2] powerpc/85xx: fix compatible property for the L2 cache node
Date: Fri, 29 Apr 2011 22:55:13 +0200	[thread overview]
Message-ID: <20110429205513.382ABD5270C@gemini.denx.de> (raw)
In-Reply-To: <20110429154457.0fee37c6@schlenkerla.am.freescale.net>

Dear Scott Wood,

In message <20110429154457.0fee37c6@schlenkerla.am.freescale.net> you wrote:
>
> > >  			len = sprintf(compat_buf,
> > > -				"fsl,mpc%s-l2-cache-controller", cpu->name);
> > > +				"fsl,mpc%s-l2-cache-controller" "%c" "cache",
> > > +				cpu->name, 0);
> > 
> > This is a somewhat funny and complicated way of writing
> > 
> > 				"fsl,mpc%s-l2-cache-controller\0cache"
> 
> Except that his version works and your version doesn't.  With your version
> sprintf will stop reading the format string after "controller".

Yes, and this is why I call this a dirty hack, as it's obfuscating
what's going on and what the intended result is.

> The alternative is two separate sprintfs, manually advancing the pointer in
> the calling code, but that's a bit more complicated and error-prone (the
> previous code did it that way, and had an error, thus this patch) and IMHO
> not more readable.

At least people who read the code in a year will then be able to
understand what you are doing.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
In general, if you think something isn't in Perl, try it out, because
it usually is :-) - Larry Wall in <1991Jul31.174523.9447@netlabs.com>

  reply	other threads:[~2011-04-29 20:55 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-29 14:58 [U-Boot] [PATCH] [v2] powerpc/85xx: fix compatible property for the L2 cache node Timur Tabi
2011-04-29 15:31 ` Kumar Gala
2011-04-29 20:33   ` Wolfgang Denk
2011-04-29 20:36     ` Kumar Gala
2011-04-29 20:40       ` Wolfgang Denk
2011-04-29 20:30 ` Wolfgang Denk
2011-04-29 20:44   ` Scott Wood
2011-04-29 20:55     ` Wolfgang Denk [this message]
2011-04-29 21:01       ` Timur Tabi
2011-04-29 22:16         ` Wolfgang Denk

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=20110429205513.382ABD5270C@gemini.denx.de \
    --to=wd@denx.de \
    --cc=u-boot@lists.denx.de \
    /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