Thread (3 messages) flat view 3 messages, 2 authors, 2011-05-06

Re: [PATCH] net/bonding: adjust codingstyle for bond_3ad files.

From: Nicolas Kaiser <hidden>
Date: 2011-05-06 13:03:20
Also in: kernel-janitors

* Rafael Aquini [off-list ref]:
quoted hunk ↗ jump to hunk
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 <redacted>
---
 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
(..)
quoted hunk ↗ jump to hunk
@@ -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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help