diff options
author | Joe Perches <joe@perches.com> | 2012-05-08 14:56:52 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-05-09 20:49:18 -0400 |
commit | b203ca39126bad99583c908be587df067820a1ea (patch) | |
tree | 940e32bd15392b400cf50c2ac31c7895637c09fe /net/mac80211/mesh_hwmp.c | |
parent | c47fc9814ca15cc075f1f09e8c069b041f2ea397 (diff) |
mac80211: Convert compare_ether_addr to ether_addr_equal
Use the new bool function ether_addr_equal to add
some clarity and reduce the likelihood for misuse
of compare_ether_addr for sorting.
Done via cocci script:
$ cat compare_ether_addr.cocci
@@
expression a,b;
@@
- !compare_ether_addr(a, b)
+ ether_addr_equal(a, b)
@@
expression a,b;
@@
- compare_ether_addr(a, b)
+ !ether_addr_equal(a, b)
@@
expression a,b;
@@
- !ether_addr_equal(a, b) == 0
+ ether_addr_equal(a, b)
@@
expression a,b;
@@
- !ether_addr_equal(a, b) != 0
+ !ether_addr_equal(a, b)
@@
expression a,b;
@@
- ether_addr_equal(a, b) == 0
+ !ether_addr_equal(a, b)
@@
expression a,b;
@@
- ether_addr_equal(a, b) != 0
+ ether_addr_equal(a, b)
@@
expression a,b;
@@
- !!ether_addr_equal(a, b)
+ ether_addr_equal(a, b)
Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/mac80211/mesh_hwmp.c')
-rw-r--r-- | net/mac80211/mesh_hwmp.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/net/mac80211/mesh_hwmp.c b/net/mac80211/mesh_hwmp.c index 503016f58631..27e0c2f06795 100644 --- a/net/mac80211/mesh_hwmp.c +++ b/net/mac80211/mesh_hwmp.c | |||
@@ -422,7 +422,7 @@ static u32 hwmp_route_info_get(struct ieee80211_sub_if_data *sdata, | |||
422 | new_metric = MAX_METRIC; | 422 | new_metric = MAX_METRIC; |
423 | exp_time = TU_TO_EXP_TIME(orig_lifetime); | 423 | exp_time = TU_TO_EXP_TIME(orig_lifetime); |
424 | 424 | ||
425 | if (compare_ether_addr(orig_addr, sdata->vif.addr) == 0) { | 425 | if (ether_addr_equal(orig_addr, sdata->vif.addr)) { |
426 | /* This MP is the originator, we are not interested in this | 426 | /* This MP is the originator, we are not interested in this |
427 | * frame, except for updating transmitter's path info. | 427 | * frame, except for updating transmitter's path info. |
428 | */ | 428 | */ |
@@ -472,7 +472,7 @@ static u32 hwmp_route_info_get(struct ieee80211_sub_if_data *sdata, | |||
472 | 472 | ||
473 | /* Update and check transmitter routing info */ | 473 | /* Update and check transmitter routing info */ |
474 | ta = mgmt->sa; | 474 | ta = mgmt->sa; |
475 | if (compare_ether_addr(orig_addr, ta) == 0) | 475 | if (ether_addr_equal(orig_addr, ta)) |
476 | fresh_info = false; | 476 | fresh_info = false; |
477 | else { | 477 | else { |
478 | fresh_info = true; | 478 | fresh_info = true; |
@@ -533,7 +533,7 @@ static void hwmp_preq_frame_process(struct ieee80211_sub_if_data *sdata, | |||
533 | 533 | ||
534 | mhwmp_dbg("received PREQ from %pM", orig_addr); | 534 | mhwmp_dbg("received PREQ from %pM", orig_addr); |
535 | 535 | ||
536 | if (compare_ether_addr(target_addr, sdata->vif.addr) == 0) { | 536 | if (ether_addr_equal(target_addr, sdata->vif.addr)) { |
537 | mhwmp_dbg("PREQ is for us"); | 537 | mhwmp_dbg("PREQ is for us"); |
538 | forward = false; | 538 | forward = false; |
539 | reply = true; | 539 | reply = true; |
@@ -631,7 +631,7 @@ static void hwmp_prep_frame_process(struct ieee80211_sub_if_data *sdata, | |||
631 | mhwmp_dbg("received PREP from %pM", PREP_IE_ORIG_ADDR(prep_elem)); | 631 | mhwmp_dbg("received PREP from %pM", PREP_IE_ORIG_ADDR(prep_elem)); |
632 | 632 | ||
633 | orig_addr = PREP_IE_ORIG_ADDR(prep_elem); | 633 | orig_addr = PREP_IE_ORIG_ADDR(prep_elem); |
634 | if (compare_ether_addr(orig_addr, sdata->vif.addr) == 0) | 634 | if (ether_addr_equal(orig_addr, sdata->vif.addr)) |
635 | /* destination, no forwarding required */ | 635 | /* destination, no forwarding required */ |
636 | return; | 636 | return; |
637 | 637 | ||
@@ -709,7 +709,7 @@ static void hwmp_perr_frame_process(struct ieee80211_sub_if_data *sdata, | |||
709 | spin_lock_bh(&mpath->state_lock); | 709 | spin_lock_bh(&mpath->state_lock); |
710 | sta = next_hop_deref_protected(mpath); | 710 | sta = next_hop_deref_protected(mpath); |
711 | if (mpath->flags & MESH_PATH_ACTIVE && | 711 | if (mpath->flags & MESH_PATH_ACTIVE && |
712 | compare_ether_addr(ta, sta->sta.addr) == 0 && | 712 | ether_addr_equal(ta, sta->sta.addr) && |
713 | (!(mpath->flags & MESH_PATH_SN_VALID) || | 713 | (!(mpath->flags & MESH_PATH_SN_VALID) || |
714 | SN_GT(target_sn, mpath->sn))) { | 714 | SN_GT(target_sn, mpath->sn))) { |
715 | mpath->flags &= ~MESH_PATH_ACTIVE; | 715 | mpath->flags &= ~MESH_PATH_ACTIVE; |
@@ -756,7 +756,7 @@ static void hwmp_rann_frame_process(struct ieee80211_sub_if_data *sdata, | |||
756 | metric = le32_to_cpu(rann->rann_metric); | 756 | metric = le32_to_cpu(rann->rann_metric); |
757 | 757 | ||
758 | /* Ignore our own RANNs */ | 758 | /* Ignore our own RANNs */ |
759 | if (compare_ether_addr(orig_addr, sdata->vif.addr) == 0) | 759 | if (ether_addr_equal(orig_addr, sdata->vif.addr)) |
760 | return; | 760 | return; |
761 | 761 | ||
762 | mhwmp_dbg("received RANN from %pM via neighbour %pM (is_gate=%d)", | 762 | mhwmp_dbg("received RANN from %pM via neighbour %pM (is_gate=%d)", |
@@ -1099,7 +1099,7 @@ int mesh_nexthop_lookup(struct sk_buff *skb, | |||
1099 | if (time_after(jiffies, | 1099 | if (time_after(jiffies, |
1100 | mpath->exp_time - | 1100 | mpath->exp_time - |
1101 | msecs_to_jiffies(sdata->u.mesh.mshcfg.path_refresh_time)) && | 1101 | msecs_to_jiffies(sdata->u.mesh.mshcfg.path_refresh_time)) && |
1102 | !compare_ether_addr(sdata->vif.addr, hdr->addr4) && | 1102 | ether_addr_equal(sdata->vif.addr, hdr->addr4) && |
1103 | !(mpath->flags & MESH_PATH_RESOLVING) && | 1103 | !(mpath->flags & MESH_PATH_RESOLVING) && |
1104 | !(mpath->flags & MESH_PATH_FIXED)) | 1104 | !(mpath->flags & MESH_PATH_FIXED)) |
1105 | mesh_queue_preq(mpath, PREQ_Q_F_START | PREQ_Q_F_REFRESH); | 1105 | mesh_queue_preq(mpath, PREQ_Q_F_START | PREQ_Q_F_REFRESH); |