[U-Boot] preferred style?

Frans Meulenbroeks fransmeulenbroeks at gmail.com
Mon Mar 22 21:51:44 CET 2010


Hi,

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)?

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?

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

Frans


More information about the U-Boot mailing list