All of lore.kernel.org
 help / color / mirror / Atom feed
From: Heiko Schocher <hs@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] preferred style?
Date: Tue, 23 Mar 2010 07:23:15 +0100	[thread overview]
Message-ID: <4BA85E53.90404@denx.de> (raw)
In-Reply-To: <ac9c93b11003221351h77c594cchd2a7b2f4cdc33f87@mail.gmail.com>

Hello Frans,

Frans Meulenbroeks wrote:
> I've been peeking at optimizing a little bit more in i2c, and I bumped
> into a stylish question:
> 
> I see function prototypes like:
> static int
> mod_i2c_mem(cmd_tbl_t *cmdtp, int incrflag, int flag, int argc, char *argv[])
> 
> and also
> int do_i2c_probe (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
> 
> A few questions on this:
> 
> is the preferred place of the type on a separate line (like for
> mod_i2c_mem) or on the same line as the function (as for
> do_i2c_probe)?

Hmm.. I prefer to have this in one line, and think, this is the
way to go ...

> Also do_i2c_probe and friends are mentioned in the subcmd table and
> are not used outside the file. (at least do_i2c_probe isn't, didn't
> check the others yet)
> So wouldn't it be preferable to have them static too?

Yep. I checked this for all do_i2c_* functions, they should be all
static. Thanks for detecting this.

> Furthermore I noticed: &cmd_i2c_sub[0]. Is this preferred above just
> writing cmd_i2c_sub (so without & and [0]).

I prefer with & and [0]

bye
Heiko
-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany

  reply	other threads:[~2010-03-23  6:23 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-22 20:51 [U-Boot] preferred style? Frans Meulenbroeks
2010-03-23  6:23 ` Heiko Schocher [this message]
2010-03-23  6:36   ` 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=4BA85E53.90404@denx.de \
    --to=hs@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.