From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Kaiser Date: Fri, 06 May 2011 13:01:14 +0000 Subject: Re: [PATCH] net/bonding: adjust codingstyle for bond_3ad files. Message-Id: <20110506150114.25513c92@absol.kitzblitz> List-Id: References: <20110506115037.GA3299@x61.tchesoft.com> In-Reply-To: <20110506115037.GA3299@x61.tchesoft.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Rafael Aquini Cc: David Miller , Joe Perches , Jay Vosburgh , Andy Gospodarek , shemminger@vyatta.com, netdev@vger.kernel.org, kernel-janitors@vger.kernel.org * Rafael Aquini : > While I was studying what bond_3ad has under its hood, I realized its coding > style did not follow all Documentation/CodingStyle recommendations. As a tiny > collaboration I did some mods there, in an attempt to make that code stick as > closely as possible with Kernel's coding style. > Modifications: > * switched all comments from C99-style to C89-style. > * replaced MAC_ADDRESS_COMPARE macro for compare_ether_addr() > > Signed-off-by: Rafael Aquini > --- > drivers/net/bonding/bond_3ad.c | 836 +++++++++++++++++++++++----------------- > drivers/net/bonding/bond_3ad.h | 195 +++++----- > 2 files changed, 579 insertions(+), 452 deletions(-) > > diff --git a/drivers/net/bonding/bond_3ad.c b/drivers/net/bonding/bond_3ad.c > index 31912f1..fdb07be 100644 > --- a/drivers/net/bonding/bond_3ad.c > +++ b/drivers/net/bonding/bond_3ad.c (..) > @@ -1533,16 +1596,15 @@ static void ad_agg_selection_logic(struct aggregator *agg) > > if (best && > __get_agg_selection_mode(best->lag_ports) = BOND_AD_STABLE) { > - /* > - * For the STABLE policy, don't replace the old active > - * aggregator if it's still active (it has an answering > - * partner) or if both the best and active don't have an > - * answering partner. > + > + /* For the STABLE policy, don't replace the old active > + * aggregator if it's still active (it has an answering partner) > + * or if both the best and active don't have answering partners > */ > if (active && active->lag_ports && > active->lag_ports->is_enabled && > (__agg_has_partner(active) || > - (!__agg_has_partner(active) && !__agg_has_partner(best)))) { > + (!__agg_has_partner(active) && !__agg_has_partner(best)))) { > if (!(!active->actor_oper_aggregator_key && > best->actor_oper_aggregator_key)) { > best = NULL; The indentation of parentheses looks correct to me in the original version. However, this expression can also be simplified like if (active && active->lag_ports && active->lag_ports->is_enabled && - (__agg_has_partner(active) || - (!__agg_has_partner(active) && !__agg_has_partner(best)))) { + (__agg_has_partner(active) || !__agg_has_partner(best))) { if (!(!active->actor_oper_aggregator_key && best->actor_oper_aggregator_key)) { best = NULL; Last October I submitted such a patch which also simplified the double negation in the subsequent expression. Best regards, Nicolas Kaiser