From: Wolfgang Denk <wd@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 5/7 v6] serial: add S3C64XX serial driver
Date: Mon, 11 Aug 2008 12:06:55 +0200 [thread overview]
Message-ID: <20080811100655.B23AD248BF@gemini.denx.de> (raw)
In-Reply-To: <Pine.LNX.4.64.0808111042400.30591@axis700.grange>
Dear Guennadi Liakhovetski,
In message <Pine.LNX.4.64.0808111042400.30591@axis700.grange> you wrote:
>
> > > + u32 reg;
> > > + u32 pclk_ratio = get_PCLK() / gd->baudrate;
> > > + int i;
> > > +
> > IMHO it's still obscur
> > > + /* PCLK / (16 * baudrate) - 1 */
> > > + reg = pclk_ratio / 16 - 1;
I don't see any baudrate in this calculation. From the comment I would
expect to see
reg = pclk_ratio / (16 * gd->baudrate) - 1;
or similar. For the reader the comment is misleading as it is
difficult to figure out that "PCLK" and "pclk_ratio" are not the same
thing.
> > > + /* i = pclk_ratio % 16 */
> > > + i = pclk_ratio - (reg + 1) * 16;
I don't see any % operation in this calculation. From the comment I
would expect to see
i = pclk_ratio % 16;
or similar. Either the comment or the code or both are wrong.
> Sorry, I don't understand how this can be made clearer yet. If you have
> any specific ideas, please let me know now, before v7 appears, because I
> would really like to make it final.
Well, maybe the code and the comments should be in sync. Actually, if
the comment just says the same as the code, it is redundant and should
be omitted. If the comment tries to describe what the code implements
in a different way that should be made clear, too.
Probably it doesn't make much sense to try to factor out common
expressions when it makes thew code more difficult to read - the
compiler is pretty clever about such things, too.
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
"Though a program be but three lines long,
someday it will have to be maintained."
- The Tao of Programming
next prev parent reply other threads:[~2008-08-11 10:06 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-06 19:41 [U-Boot-Users] [PATCH 0/7 v6] SMDK6400 support Guennadi Liakhovetski
2008-08-06 19:42 ` [U-Boot-Users] [PATCH 2/7 v6] nand_spl: Support page-aligned read in nand_load, use chipselect Guennadi Liakhovetski
2008-08-06 22:54 ` Scott Wood
2008-08-07 6:36 ` Guennadi Liakhovetski
2008-08-06 19:42 ` [U-Boot-Users] [PATCH 3/7 v6] ARM: Add arm1176 core with S3C6400 SoC Guennadi Liakhovetski
2008-08-07 6:28 ` Andreas Engel
2008-08-07 6:55 ` Guennadi Liakhovetski
2008-08-07 9:33 ` Jens Gehrlein
2008-08-07 9:51 ` Wolfgang Denk
2008-08-07 10:03 ` Jens Gehrlein
2008-08-07 10:17 ` Wolfgang Denk
2008-08-07 11:03 ` Jens Gehrlein
2008-08-07 11:07 ` Jean-Christophe PLAGNIOL-VILLARD
2008-08-07 10:00 ` Jens Gehrlein
2008-08-07 10:12 ` Guennadi Liakhovetski
2008-08-07 11:12 ` Jens Gehrlein
2008-08-09 9:11 ` Jean-Christophe PLAGNIOL-VILLARD
2008-08-09 9:58 ` [U-Boot] " Wolfgang Denk
2008-08-09 10:07 ` Jean-Christophe PLAGNIOL-VILLARD
2008-08-11 8:17 ` [U-Boot-Users] " Guennadi Liakhovetski
2008-08-06 19:42 ` [U-Boot-Users] [PATCH 4/7 v6] USB: Add support for OHCI controller on S3C6400 Guennadi Liakhovetski
2008-08-07 15:56 ` Markus Klotzbücher
2008-08-07 15:53 ` Jean-Christophe PLAGNIOL-VILLARD
2008-08-08 9:16 ` Markus Klotzbücher
2008-08-06 19:42 ` [U-Boot-Users] [PATCH 5/7 v6] serial: add S3C64XX serial driver Guennadi Liakhovetski
2008-08-09 9:13 ` Jean-Christophe PLAGNIOL-VILLARD
2008-08-11 8:44 ` Guennadi Liakhovetski
2008-08-11 10:06 ` Wolfgang Denk [this message]
2008-08-11 10:53 ` [U-Boot] " Guennadi Liakhovetski
2008-08-11 12:12 ` Wolfgang Denk
2008-08-11 12:43 ` Guennadi Liakhovetski
2008-08-06 19:42 ` [U-Boot-Users] [PATCH 6/7 v6] NAND: add NAND driver for S3C64XX Guennadi Liakhovetski
2008-08-07 22:15 ` Scott Wood
2008-08-06 19:42 ` [U-Boot-Users] [PATCH 7/7 v6] ARM: Add support for S3C6400 based SMDK6400 board Guennadi Liakhovetski
2008-08-09 9:32 ` Jean-Christophe PLAGNIOL-VILLARD
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=20080811100655.B23AD248BF@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