aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet
diff options
context:
space:
mode:
authorJoe Perches <joe@perches.com>2012-05-09 13:17:46 -0400
committerDavid S. Miller <davem@davemloft.net>2012-05-10 23:33:01 -0400
commit2e42e4747ea72943c21551d8a206b51a9893b1e0 (patch)
treea92473c485911b51e1d960c9c8fa34dfc9be0a46 /drivers/net/ethernet
parent39f1d94d300a58eb3e9b851d077cada4e2fa9d46 (diff)
drivers/net: 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 'drivers/net/ethernet')
-rw-r--r--drivers/net/ethernet/amd/depca.c3
-rw-r--r--drivers/net/ethernet/cisco/enic/enic_main.c12
-rw-r--r--drivers/net/ethernet/dec/ewrk3.c3
-rw-r--r--drivers/net/ethernet/dec/tulip/de4x5.c2
-rw-r--r--drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c5
-rw-r--r--drivers/net/ethernet/sfc/ethtool.c2
-rw-r--r--drivers/net/ethernet/sun/sunvnet.c2
-rw-r--r--drivers/net/ethernet/tile/tilepro.c2
-rw-r--r--drivers/net/ethernet/toshiba/ps3_gelic_wireless.c8
9 files changed, 18 insertions, 21 deletions
diff --git a/drivers/net/ethernet/amd/depca.c b/drivers/net/ethernet/amd/depca.c
index 86dd95766a64..7f7b99a5f024 100644
--- a/drivers/net/ethernet/amd/depca.c
+++ b/drivers/net/ethernet/amd/depca.c
@@ -1079,7 +1079,8 @@ static int depca_rx(struct net_device *dev)
1079 } else { 1079 } else {
1080 lp->pktStats.multicast++; 1080 lp->pktStats.multicast++;
1081 } 1081 }
1082 } else if (compare_ether_addr(buf, dev->dev_addr) == 0) { 1082 } else if (ether_addr_equal(buf,
1083 dev->dev_addr)) {
1083 lp->pktStats.unicast++; 1084 lp->pktStats.unicast++;
1084 } 1085 }
1085 1086
diff --git a/drivers/net/ethernet/cisco/enic/enic_main.c b/drivers/net/ethernet/cisco/enic/enic_main.c
index d7ac6c17547c..8132c785cea8 100644
--- a/drivers/net/ethernet/cisco/enic/enic_main.c
+++ b/drivers/net/ethernet/cisco/enic/enic_main.c
@@ -944,8 +944,7 @@ static void enic_update_multicast_addr_list(struct enic *enic)
944 944
945 for (i = 0; i < enic->mc_count; i++) { 945 for (i = 0; i < enic->mc_count; i++) {
946 for (j = 0; j < mc_count; j++) 946 for (j = 0; j < mc_count; j++)
947 if (compare_ether_addr(enic->mc_addr[i], 947 if (ether_addr_equal(enic->mc_addr[i], mc_addr[j]))
948 mc_addr[j]) == 0)
949 break; 948 break;
950 if (j == mc_count) 949 if (j == mc_count)
951 enic_dev_del_addr(enic, enic->mc_addr[i]); 950 enic_dev_del_addr(enic, enic->mc_addr[i]);
@@ -953,8 +952,7 @@ static void enic_update_multicast_addr_list(struct enic *enic)
953 952
954 for (i = 0; i < mc_count; i++) { 953 for (i = 0; i < mc_count; i++) {
955 for (j = 0; j < enic->mc_count; j++) 954 for (j = 0; j < enic->mc_count; j++)
956 if (compare_ether_addr(mc_addr[i], 955 if (ether_addr_equal(mc_addr[i], enic->mc_addr[j]))
957 enic->mc_addr[j]) == 0)
958 break; 956 break;
959 if (j == enic->mc_count) 957 if (j == enic->mc_count)
960 enic_dev_add_addr(enic, mc_addr[i]); 958 enic_dev_add_addr(enic, mc_addr[i]);
@@ -999,8 +997,7 @@ static void enic_update_unicast_addr_list(struct enic *enic)
999 997
1000 for (i = 0; i < enic->uc_count; i++) { 998 for (i = 0; i < enic->uc_count; i++) {
1001 for (j = 0; j < uc_count; j++) 999 for (j = 0; j < uc_count; j++)
1002 if (compare_ether_addr(enic->uc_addr[i], 1000 if (ether_addr_equal(enic->uc_addr[i], uc_addr[j]))
1003 uc_addr[j]) == 0)
1004 break; 1001 break;
1005 if (j == uc_count) 1002 if (j == uc_count)
1006 enic_dev_del_addr(enic, enic->uc_addr[i]); 1003 enic_dev_del_addr(enic, enic->uc_addr[i]);
@@ -1008,8 +1005,7 @@ static void enic_update_unicast_addr_list(struct enic *enic)
1008 1005
1009 for (i = 0; i < uc_count; i++) { 1006 for (i = 0; i < uc_count; i++) {
1010 for (j = 0; j < enic->uc_count; j++) 1007 for (j = 0; j < enic->uc_count; j++)
1011 if (compare_ether_addr(uc_addr[i], 1008 if (ether_addr_equal(uc_addr[i], enic->uc_addr[j]))
1012 enic->uc_addr[j]) == 0)
1013 break; 1009 break;
1014 if (j == enic->uc_count) 1010 if (j == enic->uc_count)
1015 enic_dev_add_addr(enic, uc_addr[i]); 1011 enic_dev_add_addr(enic, uc_addr[i]);
diff --git a/drivers/net/ethernet/dec/ewrk3.c b/drivers/net/ethernet/dec/ewrk3.c
index 1879f84a25a3..17ae8c619680 100644
--- a/drivers/net/ethernet/dec/ewrk3.c
+++ b/drivers/net/ethernet/dec/ewrk3.c
@@ -1016,7 +1016,8 @@ static int ewrk3_rx(struct net_device *dev)
1016 } else { 1016 } else {
1017 lp->pktStats.multicast++; 1017 lp->pktStats.multicast++;
1018 } 1018 }
1019 } else if (compare_ether_addr(p, dev->dev_addr) == 0) { 1019 } else if (ether_addr_equal(p,
1020 dev->dev_addr)) {
1020 lp->pktStats.unicast++; 1021 lp->pktStats.unicast++;
1021 } 1022 }
1022 lp->pktStats.bins[0]++; /* Duplicates stats.rx_packets */ 1023 lp->pktStats.bins[0]++; /* Duplicates stats.rx_packets */
diff --git a/drivers/net/ethernet/dec/tulip/de4x5.c b/drivers/net/ethernet/dec/tulip/de4x5.c
index 18b106cc6d2b..d3cd489d11a2 100644
--- a/drivers/net/ethernet/dec/tulip/de4x5.c
+++ b/drivers/net/ethernet/dec/tulip/de4x5.c
@@ -1874,7 +1874,7 @@ de4x5_local_stats(struct net_device *dev, char *buf, int pkt_len)
1874 } else { 1874 } else {
1875 lp->pktStats.multicast++; 1875 lp->pktStats.multicast++;
1876 } 1876 }
1877 } else if (compare_ether_addr(buf, dev->dev_addr) == 0) { 1877 } else if (ether_addr_equal(buf, dev->dev_addr)) {
1878 lp->pktStats.unicast++; 1878 lp->pktStats.unicast++;
1879 } 1879 }
1880 1880
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
index 5c4713521d4c..46e77a2c5121 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c
@@ -1965,7 +1965,7 @@ qlcnic_send_filter(struct qlcnic_adapter *adapter,
1965 __le16 vlan_id = 0; 1965 __le16 vlan_id = 0;
1966 u8 hindex; 1966 u8 hindex;
1967 1967
1968 if (!compare_ether_addr(phdr->h_source, adapter->mac_addr)) 1968 if (ether_addr_equal(phdr->h_source, adapter->mac_addr))
1969 return; 1969 return;
1970 1970
1971 if (adapter->fhash.fnum >= adapter->fhash.fmax) 1971 if (adapter->fhash.fnum >= adapter->fhash.fmax)
@@ -2235,8 +2235,7 @@ qlcnic_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
2235 2235
2236 if (adapter->flags & QLCNIC_MACSPOOF) { 2236 if (adapter->flags & QLCNIC_MACSPOOF) {
2237 phdr = (struct ethhdr *)skb->data; 2237 phdr = (struct ethhdr *)skb->data;
2238 if (compare_ether_addr(phdr->h_source, 2238 if (!ether_addr_equal(phdr->h_source, adapter->mac_addr))
2239 adapter->mac_addr))
2240 goto drop_packet; 2239 goto drop_packet;
2241 } 2240 }
2242 2241
diff --git a/drivers/net/ethernet/sfc/ethtool.c b/drivers/net/ethernet/sfc/ethtool.c
index b0a4558de248..03ded364c8da 100644
--- a/drivers/net/ethernet/sfc/ethtool.c
+++ b/drivers/net/ethernet/sfc/ethtool.c
@@ -1023,7 +1023,7 @@ static int efx_ethtool_set_class_rule(struct efx_nic *efx,
1023 return -EINVAL; 1023 return -EINVAL;
1024 1024
1025 /* Is it a default UC or MC filter? */ 1025 /* Is it a default UC or MC filter? */
1026 if (!compare_ether_addr(mac_mask->h_dest, mac_addr_mc_mask) && 1026 if (ether_addr_equal(mac_mask->h_dest, mac_addr_mc_mask) &&
1027 vlan_tag_mask == 0) { 1027 vlan_tag_mask == 0) {
1028 if (is_multicast_ether_addr(mac_entry->h_dest)) 1028 if (is_multicast_ether_addr(mac_entry->h_dest))
1029 rc = efx_filter_set_mc_def(&spec); 1029 rc = efx_filter_set_mc_def(&spec);
diff --git a/drivers/net/ethernet/sun/sunvnet.c b/drivers/net/ethernet/sun/sunvnet.c
index 38e3ae9155b7..a108db35924e 100644
--- a/drivers/net/ethernet/sun/sunvnet.c
+++ b/drivers/net/ethernet/sun/sunvnet.c
@@ -618,7 +618,7 @@ struct vnet_port *__tx_port_find(struct vnet *vp, struct sk_buff *skb)
618 struct vnet_port *port; 618 struct vnet_port *port;
619 619
620 hlist_for_each_entry(port, n, hp, hash) { 620 hlist_for_each_entry(port, n, hp, hash) {
621 if (!compare_ether_addr(port->raddr, skb->data)) 621 if (ether_addr_equal(port->raddr, skb->data))
622 return port; 622 return port;
623 } 623 }
624 port = NULL; 624 port = NULL;
diff --git a/drivers/net/ethernet/tile/tilepro.c b/drivers/net/ethernet/tile/tilepro.c
index 3d501ec7fad7..96070e9b50dc 100644
--- a/drivers/net/ethernet/tile/tilepro.c
+++ b/drivers/net/ethernet/tile/tilepro.c
@@ -843,7 +843,7 @@ static bool tile_net_poll_aux(struct tile_net_cpu *info, int index)
843 if (!is_multicast_ether_addr(buf)) { 843 if (!is_multicast_ether_addr(buf)) {
844 /* Filter packets not for our address. */ 844 /* Filter packets not for our address. */
845 const u8 *mine = dev->dev_addr; 845 const u8 *mine = dev->dev_addr;
846 filter = compare_ether_addr(mine, buf); 846 filter = !ether_addr_equal(mine, buf);
847 } 847 }
848 } 848 }
849 849
diff --git a/drivers/net/ethernet/toshiba/ps3_gelic_wireless.c b/drivers/net/ethernet/toshiba/ps3_gelic_wireless.c
index 5c14f82c4954..961c8321451f 100644
--- a/drivers/net/ethernet/toshiba/ps3_gelic_wireless.c
+++ b/drivers/net/ethernet/toshiba/ps3_gelic_wireless.c
@@ -1590,8 +1590,8 @@ static void gelic_wl_scan_complete_event(struct gelic_wl_info *wl)
1590 found = 0; 1590 found = 0;
1591 oldest = NULL; 1591 oldest = NULL;
1592 list_for_each_entry(target, &wl->network_list, list) { 1592 list_for_each_entry(target, &wl->network_list, list) {
1593 if (!compare_ether_addr(&target->hwinfo->bssid[2], 1593 if (ether_addr_equal(&target->hwinfo->bssid[2],
1594 &scan_info->bssid[2])) { 1594 &scan_info->bssid[2])) {
1595 found = 1; 1595 found = 1;
1596 pr_debug("%s: same BBS found scanned list\n", 1596 pr_debug("%s: same BBS found scanned list\n",
1597 __func__); 1597 __func__);
@@ -1691,8 +1691,8 @@ struct gelic_wl_scan_info *gelic_wl_find_best_bss(struct gelic_wl_info *wl)
1691 1691
1692 /* If bss specified, check it only */ 1692 /* If bss specified, check it only */
1693 if (test_bit(GELIC_WL_STAT_BSSID_SET, &wl->stat)) { 1693 if (test_bit(GELIC_WL_STAT_BSSID_SET, &wl->stat)) {
1694 if (!compare_ether_addr(&scan_info->hwinfo->bssid[2], 1694 if (ether_addr_equal(&scan_info->hwinfo->bssid[2],
1695 wl->bssid)) { 1695 wl->bssid)) {
1696 best_bss = scan_info; 1696 best_bss = scan_info;
1697 pr_debug("%s: bssid matched\n", __func__); 1697 pr_debug("%s: bssid matched\n", __func__);
1698 break; 1698 break;