On Thu, 2010-08-26 at 18:56 +0900, Masayuki Ohtake wrote:
Just a few style comments
Perhaps better to use the kernel true/false.
Better to use
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
and
pr_debug(fmt, ...);
[]
Trivial: Inconsistent spacing (a few times)
Perhaps:
s32 (*read_phy_reg) etc...
[]
[]
Convert all the
printk(KERN_<level> KBUILD_MODNAME ": " etc
to
pr_<level>(etc
[]
pr_err("pch_gbe_phy_get_id error\n");
pr_err("ERROR: Registers not mapped\n");
etc...
These are more commonly written as:
if (!fn_ptr) {
[ report_error_condition ]
return -ERRNO;
}
rtn = fn_ptr(foo);
if (rtn is err) {
[ report_error_condition ]
return -ERRNO2;
}
return 0;
For more complicated styles where some unwinding
is necessary
if (!fn_ptr) {
[ report_error_condition ]
err = -ERRNO;
goto out;
}
windup
rtn = fn_ptr(foo);
if (rtn is err) {
[ report_error_condition ]
err = ERRNO2
goto out2;
}
return 0;
outn:
..
out2:
unwind;
out:
return err;
pr_err("ERROR: configuration\n");
etc...
[]
Add #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
before any include
[]
If you really want to track entering functions,
it might be better to use something like:
#define FUNC_ENTER() pr_devel("ethtool: %s enter\n", __func__)
#define FUNC_EXIT() pr_devel("ethtool: %s exit\n", __func__)
Unlike pr_debug, pr_devel does not remain active in
code when DEBUG is not #defined. Look up dynamic_debug.
There's a vsprintf pointer extension "%pM" used for mac addresses
pr_debug("hw->mac.addr: %pM\n, hw->mac.addr);
etc.
--