From: Wolfgang Denk <wd@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 3/4] ELPPC: Don't write magic numbers via short.
Date: Tue, 14 May 2013 00:40:01 +0200 [thread overview]
Message-ID: <20130513224001.4F6AB3804AF@gemini.denx.de> (raw)
In-Reply-To: <1368477117-32669-3-git-send-email-trini@ti.com>
Dear Tom Rini,
In message <1368477117-32669-3-git-send-email-trini@ti.com> you wrote:
> We need to write each segment of the buffer directly rather than using
> shorts.
>
> Cc: Frank Gottschling <fgottschling@eltec.de>
> Signed-off-by: Tom Rini <trini@ti.com>
> ---
> board/eltec/elppc/misc.c | 9 ++++++---
> 1 file changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/board/eltec/elppc/misc.c b/board/eltec/elppc/misc.c
> index 89f1b1d..a7d8486 100644
> --- a/board/eltec/elppc/misc.c
> +++ b/board/eltec/elppc/misc.c
> @@ -207,9 +207,12 @@ int misc_init_r (void)
> buf[4] = eerev.etheraddr[5];
> buf[5] = eerev.etheraddr[4];
>
> - *(unsigned short *) &buf[20] = 0x48B2;
> - *(unsigned short *) &buf[22] = 0x0004;
> - *(unsigned short *) &buf[24] = 0x1433;
> + buf[20] = 0x48;
> + buf[21] = 0xB2;
> + buf[22] = 0x00;
> + buf[23] = 0x04;
> + buf[24] = 0x14;
> + buf[25] = 0x33;
I guess the 16 bit numbers originally written had some meaning, so
there should be at least a comment explaining the code.
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
My challenge to the goto-less programmer is to recode tcp_input()
without any gotos ... without any loss of efficiency (there has to be
a catch). - W. R. Stevens
next prev parent reply other threads:[~2013-05-13 22:40 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-13 20:31 [U-Boot] [PATCH 1/4] powerpc: Correct im_dprambase cast Tom Rini
2013-05-13 20:31 ` [U-Boot] [PATCH 2/4] mpc8xx: Correct cast of im_cpm.cp_dparam Tom Rini
2013-05-13 22:34 ` Wolfgang Denk
2013-05-14 10:26 ` Wolfgang Denk
2013-05-15 23:16 ` Scott Wood
2013-05-14 13:14 ` Tom Rini
2013-05-13 20:31 ` [U-Boot] [PATCH 3/4] ELPPC: Don't write magic numbers via short Tom Rini
2013-05-13 22:40 ` Wolfgang Denk [this message]
2013-05-13 20:31 ` [U-Boot] [PATCH 4/4] mpc8323erdb: Update crc32 check of MAC Tom Rini
2013-05-13 22:38 ` Wolfgang Denk
2013-05-13 22:37 ` [U-Boot] [PATCH 1/4] powerpc: Correct im_dprambase cast 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=20130513224001.4F6AB3804AF@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