提交 150238eb 编写于 作者: J Joe Perches 提交者: David S. Miller

atm: 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: NJoe Perches <joe@perches.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 9a7b6ef9
...@@ -1255,7 +1255,7 @@ static int lane2_associate_req(struct net_device *dev, const u8 *lan_dst, ...@@ -1255,7 +1255,7 @@ static int lane2_associate_req(struct net_device *dev, const u8 *lan_dst,
struct sk_buff *skb; struct sk_buff *skb;
struct lec_priv *priv = netdev_priv(dev); struct lec_priv *priv = netdev_priv(dev);
if (compare_ether_addr(lan_dst, dev->dev_addr)) if (!ether_addr_equal(lan_dst, dev->dev_addr))
return 0; /* not our mac address */ return 0; /* not our mac address */
kfree(priv->tlvs); /* NULL if there was no previous association */ kfree(priv->tlvs); /* NULL if there was no previous association */
...@@ -1662,7 +1662,7 @@ static struct lec_arp_table *lec_arp_find(struct lec_priv *priv, ...@@ -1662,7 +1662,7 @@ static struct lec_arp_table *lec_arp_find(struct lec_priv *priv,
head = &priv->lec_arp_tables[HASH(mac_addr[ETH_ALEN - 1])]; head = &priv->lec_arp_tables[HASH(mac_addr[ETH_ALEN - 1])];
hlist_for_each_entry(entry, node, head, next) { hlist_for_each_entry(entry, node, head, next) {
if (!compare_ether_addr(mac_addr, entry->mac_addr)) if (ether_addr_equal(mac_addr, entry->mac_addr))
return entry; return entry;
} }
return NULL; return NULL;
...@@ -1849,7 +1849,7 @@ static struct atm_vcc *lec_arp_resolve(struct lec_priv *priv, ...@@ -1849,7 +1849,7 @@ static struct atm_vcc *lec_arp_resolve(struct lec_priv *priv,
case 1: case 1:
return priv->mcast_vcc; return priv->mcast_vcc;
case 2: /* LANE2 wants arp for multicast addresses */ case 2: /* LANE2 wants arp for multicast addresses */
if (!compare_ether_addr(mac_to_find, bus_mac)) if (ether_addr_equal(mac_to_find, bus_mac))
return priv->mcast_vcc; return priv->mcast_vcc;
break; break;
default: default:
......
...@@ -592,8 +592,7 @@ static netdev_tx_t mpc_send_packet(struct sk_buff *skb, ...@@ -592,8 +592,7 @@ static netdev_tx_t mpc_send_packet(struct sk_buff *skb,
goto non_ip; goto non_ip;
while (i < mpc->number_of_mps_macs) { while (i < mpc->number_of_mps_macs) {
if (!compare_ether_addr(eth->h_dest, if (ether_addr_equal(eth->h_dest, mpc->mps_macs + i * ETH_ALEN))
(mpc->mps_macs + i*ETH_ALEN)))
if (send_via_shortcut(skb, mpc) == 0) /* try shortcut */ if (send_via_shortcut(skb, mpc) == 0) /* try shortcut */
return NETDEV_TX_OK; return NETDEV_TX_OK;
i++; i++;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册