From: Nicolas Kaiser <nikai@nikai.net>
To: Rafael Aquini <aquini@linux.com>
Cc: David Miller <davem@davemloft.net>, Joe Perches <joe@perches.com>,
Jay Vosburgh <fubar@us.ibm.com>,
Andy Gospodarek <andy@greyhouse.net>,
shemminger@vyatta.com, netdev@vger.kernel.org,
kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] net/bonding: adjust codingstyle for bond_3ad files.
Date: Fri, 06 May 2011 13:01:14 +0000 [thread overview]
Message-ID: <20110506150114.25513c92@absol.kitzblitz> (raw)
In-Reply-To: <20110506115037.GA3299@x61.tchesoft.com>
* Rafael Aquini <aquini@linux.com>:
> 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 <aquini@linux.com>
> ---
> 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
next prev parent reply other threads:[~2011-05-06 13:01 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-06 11:50 [PATCH] net/bonding: adjust codingstyle for bond_3ad files Rafael Aquini
2011-05-06 13:01 ` Nicolas Kaiser [this message]
2011-05-06 14:56 ` Rafael Aquini
2011-05-07 1:27 ` Rafael Aquini
2011-05-07 1:51 ` Joe Perches
2011-05-07 17:31 ` Rafael Aquini
2011-05-07 18:02 ` Joe Perches
2011-05-07 19:35 ` matt mooney
2011-05-07 20:24 ` Joe Perches
2011-05-08 23:08 ` Håkon Løvdal
2011-05-08 23:10 ` David Miller
2011-05-09 0:08 ` Håkon Løvdal
2011-05-09 0:12 ` David Miller
2011-05-09 1:30 ` Håkon Løvdal
2011-05-07 21:25 ` Jay Vosburgh
2011-05-07 21:37 ` Rafael Aquini
2011-05-10 0:08 ` Rafael Aquini
2011-05-10 0:15 ` Joe Perches
2011-05-10 2:00 ` Jay Vosburgh
2011-05-10 2:11 ` Joe Perches
2011-05-10 12:22 ` Rafael Aquini
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=20110506150114.25513c92@absol.kitzblitz \
--to=nikai@nikai.net \
--cc=andy@greyhouse.net \
--cc=aquini@linux.com \
--cc=davem@davemloft.net \
--cc=fubar@us.ibm.com \
--cc=joe@perches.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=shemminger@vyatta.com \
/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